fix: 删除最后一个节点时报错
例子:https://www.iviewui.com/components/tree#ZDYJDNR,删除最后一个节点时,控制台报错,找不到节点,因为被删除了。
This commit is contained in:
parent
a5f6f6cfcd
commit
076310a789
1 changed files with 2 additions and 0 deletions
|
@ -171,6 +171,7 @@
|
|||
}
|
||||
},
|
||||
handleSelect (nodeKey) {
|
||||
if (!this.flatState[nodeKey]) return
|
||||
const node = this.flatState[nodeKey].node;
|
||||
if (!this.multiple){ // reset previously selected node
|
||||
const currentSelectedKey = this.flatState.findIndex(obj => obj.node.selected);
|
||||
|
@ -181,6 +182,7 @@
|
|||
this.$emit('on-select-change', this.getSelectedNodes(), node);
|
||||
},
|
||||
handleCheck({ checked, nodeKey }) {
|
||||
if (!this.flatState[nodeKey]) return
|
||||
const node = this.flatState[nodeKey].node;
|
||||
this.$set(node, 'checked', checked);
|
||||
this.$set(node, 'indeterminate', false);
|
||||
|
|
Loading…
Add table
Reference in a new issue