import { createNamespace } from '../utils'; import { ParentMixin } from '../mixins/relation'; const [createComponent, bem] = createNamespace('tabbar'); export default createComponent({ mixins: [ParentMixin('vanTabbar')], props: { route: Boolean, activeColor: String, inactiveColor: String, safeAreaInsetBottom: Boolean, value: { type: [Number, String], default: 0 }, border: { type: Boolean, default: true }, fixed: { type: Boolean, default: true }, zIndex: { type: Number, default: 1 } }, watch: { value: 'setActiveItem', children: 'setActiveItem' }, methods: { setActiveItem() { this.children.forEach((item, index) => { item.active = (item.name || index) === this.value; }); }, onChange(active) { if (active !== this.value) { this.$emit('input', active); this.$emit('change', active); } } }, render() { return (
{this.slots()}
); } });