Commit cf0197e0 authored by baiyaaaaa's avatar baiyaaaaa Committed by 杨奕

Collapse: fix $parent bug when collapse-item is nested in other components (#7675)

* fix collapse  bug

* fix code style
parent 4517e3d9
......@@ -62,6 +62,8 @@
};
},
inject: ['collapse'],
props: {
title: String,
name: {
......@@ -74,18 +76,13 @@
computed: {
isActive() {
return this.$parent.activeNames.indexOf(this.name) > -1;
return this.collapse.activeNames.indexOf(this.name) > -1;
},
id() {
return generateId();
}
},
watch: {
'isActive'(value) {
}
},
methods: {
handleHeaderClick() {
this.dispatch('ElCollapse', 'item-click', this);
......@@ -94,9 +91,6 @@
handleEnterClick() {
this.dispatch('ElCollapse', 'item-click', this);
}
},
mounted() {
}
};
</script>
......@@ -25,6 +25,12 @@
};
},
provide() {
return {
collapse: this
};
},
watch: {
value(value) {
this.activeNames = [].concat(value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment