mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
33 lines
713 B
JavaScript
33 lines
713 B
JavaScript
import { VantComponent } from '../common/component';
|
|
VantComponent({
|
|
props: {
|
|
info: null,
|
|
icon: String,
|
|
dot: Boolean
|
|
},
|
|
relation: {
|
|
name: 'tabbar',
|
|
type: 'ancestor',
|
|
linked(target) {
|
|
this.parent = target;
|
|
}
|
|
},
|
|
data: {
|
|
active: false
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
if (this.parent) {
|
|
this.parent.onChange(this);
|
|
}
|
|
this.$emit('click');
|
|
},
|
|
setActive({ active, color }) {
|
|
if (this.data.active !== active) {
|
|
return this.set({ active, color });
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
});
|