This commit is contained in:
2019-12-14 09:20:48 +08:00
parent 57e95e3217
commit 933673b092
372 changed files with 8090 additions and 0 deletions

36
utils/dist/sidebar-item/index.js vendored Normal file
View File

@@ -0,0 +1,36 @@
import { VantComponent } from '../common/component';
VantComponent({
classes: [
'active-class',
'disabled-class',
],
relation: {
type: 'ancestor',
name: 'sidebar',
linked(target) {
this.parent = target;
}
},
props: {
dot: Boolean,
info: null,
title: String,
disabled: Boolean
},
methods: {
onClick() {
const { parent } = this;
if (!parent || this.data.disabled) {
return;
}
const index = parent.children.indexOf(this);
parent.setActive(index).then(() => {
this.$emit('click', index);
parent.$emit('change', index);
});
},
setActive(selected) {
return this.setData({ selected });
}
}
});