Commit fd57b83db676262874efa0996d49dcc442484b07
1 parent
513ccb95
fix(basicTree): checked with searching, fixed #2070
Showing
1 changed file
with
8 additions
and
4 deletions
src/components/Tree/src/BasicTree.vue
@@ -90,10 +90,10 @@ | @@ -90,10 +90,10 @@ | ||
90 | onCheck: (v: CheckKeys, e) => { | 90 | onCheck: (v: CheckKeys, e) => { |
91 | let currentValue = toRaw(state.checkedKeys) as KeyType[]; | 91 | let currentValue = toRaw(state.checkedKeys) as KeyType[]; |
92 | if (isArray(currentValue) && searchState.startSearch) { | 92 | if (isArray(currentValue) && searchState.startSearch) { |
93 | - const { key } = unref(getFieldNames); | ||
94 | - currentValue = difference(currentValue, getChildrenKeys(e.node.$attrs.node[key])); | 93 | + const value = e.node.eventKey; |
94 | + currentValue = difference(currentValue, getChildrenKeys(value)); | ||
95 | if (e.checked) { | 95 | if (e.checked) { |
96 | - currentValue.push(e.node.$attrs.node[key]); | 96 | + currentValue.push(value); |
97 | } | 97 | } |
98 | state.checkedKeys = currentValue; | 98 | state.checkedKeys = currentValue; |
99 | } else { | 99 | } else { |
@@ -437,7 +437,11 @@ | @@ -437,7 +437,11 @@ | ||
437 | {extendSlots(slots)} | 437 | {extendSlots(slots)} |
438 | </TreeHeader> | 438 | </TreeHeader> |
439 | )} | 439 | )} |
440 | - <Spin wrapperClassName={unref(props.treeWrapperClassName)} spinning={unref(props.loading)} tip="加载中..."> | 440 | + <Spin |
441 | + wrapperClassName={unref(props.treeWrapperClassName)} | ||
442 | + spinning={unref(props.loading)} | ||
443 | + tip="加载中..." | ||
444 | + > | ||
441 | <ScrollContainer style={scrollStyle} v-show={!unref(getNotFound)}> | 445 | <ScrollContainer style={scrollStyle} v-show={!unref(getNotFound)}> |
442 | <Tree {...unref(getBindValues)} showIcon={false} treeData={treeData.value} /> | 446 | <Tree {...unref(getBindValues)} showIcon={false} treeData={treeData.value} /> |
443 | </ScrollContainer> | 447 | </ScrollContainer> |