UNPKG

vant-fork

Version:

Lightweight Mobile UI Components built on Vue

65 lines (61 loc) 1.23 kB
import create from '../utils/create'; export default create({ render: function render() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c('div', { staticClass: "van-hairline--top-bottom", class: _vm.b({ fixed: _vm.fixed }), style: _vm.style }, [_vm._t("default")], 2); }, name: 'tabbar', data: function data() { return { items: [] }; }, props: { value: Number, fixed: { type: Boolean, default: true }, zIndex: { type: Number, default: 1 } }, computed: { style: function style() { return { zIndex: this.zIndex }; } }, watch: { items: function items() { this.setActiveItem(); }, value: function value() { this.setActiveItem(); } }, methods: { setActiveItem: function setActiveItem() { var _this = this; this.items.forEach(function (item, index) { item.active = index === _this.value; }); }, onChange: function onChange(active) { if (active !== this.value) { this.$emit('input', active); this.$emit('change', active); } } } });