mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
38 lines
625 B
JavaScript
38 lines
625 B
JavaScript
import { VantComponent } from '../common/component';
|
|
|
|
VantComponent({
|
|
props: {
|
|
info: null,
|
|
icon: String,
|
|
dot: Boolean
|
|
},
|
|
|
|
relations: {
|
|
'../tabbar/index': {
|
|
type: 'ancestor'
|
|
}
|
|
},
|
|
|
|
data: {
|
|
active: false,
|
|
count: 0
|
|
},
|
|
|
|
methods: {
|
|
onClick() {
|
|
const parent = this.getRelationNodes('../tabbar/index')[0];
|
|
if (parent) {
|
|
parent.onChange(this);
|
|
}
|
|
this.$emit('click');
|
|
},
|
|
|
|
setActive(data) {
|
|
const { active, count } = this.data;
|
|
if (active !== data.active || count !== data.count) {
|
|
this.setData(data);
|
|
}
|
|
}
|
|
}
|
|
});
|