fix 对用例模块进行相关操作之后树组件自动折叠问题

This commit is contained in:
shiziyuan9527 2020-06-23 14:58:40 +08:00
parent 5cc1ff291a
commit aabfd2a38d
1 changed files with 10 additions and 0 deletions

View File

@ -9,8 +9,11 @@
<el-tree <el-tree
class="filter-tree node-tree" class="filter-tree node-tree"
:data="treeNodes" :data="treeNodes"
:default-expanded-keys="expandedNode"
node-key="id" node-key="id"
@node-drag-end="handleDragEnd" @node-drag-end="handleDragEnd"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
:filter-node-method="filterNode" :filter-node-method="filterNode"
:expand-on-click-node="false" :expand-on-click-node="false"
highlight-current highlight-current
@ -64,6 +67,7 @@ export default {
data() { data() {
return { return {
result: {}, result: {},
expandedNode: [],
filterText: "", filterText: "",
defaultProps: { defaultProps: {
children: "children", children: "children",
@ -216,6 +220,12 @@ export default {
}, },
refreshNode() { refreshNode() {
this.$emit("refresh"); this.$emit("refresh");
},
nodeExpand(data) {
this.expandedNode.push(data.id);
},
nodeCollapse(data) {
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
} }
} }
}; };