fix(Sidebar): should emit change when v-model changed (#6383)

This commit is contained in:
neverland
2020-05-26 19:44:59 +08:00
committed by GitHub
parent 126f2124a2
commit 67a5a8d76c
4 changed files with 39 additions and 8 deletions
+21
View File
@@ -17,6 +17,27 @@ export default createComponent({
},
},
data() {
return {
index: +this.activeKey,
};
},
watch: {
activeKey() {
this.setIndex(+this.activeKey);
},
},
methods: {
setIndex(index) {
if (index !== this.index) {
this.index = index;
this.$emit('change', index);
}
},
},
render() {
return <div class={bem()}>{this.slots()}</div>;
},