Commit fd57b83db676262874efa0996d49dcc442484b07

Authored by 无木
1 parent 513ccb95

fix(basicTree): checked with searching, fixed #2070

src/components/Tree/src/BasicTree.vue
... ... @@ -90,10 +90,10 @@
90 90 onCheck: (v: CheckKeys, e) => {
91 91 let currentValue = toRaw(state.checkedKeys) as KeyType[];
92 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 95 if (e.checked) {
96   - currentValue.push(e.node.$attrs.node[key]);
  96 + currentValue.push(value);
97 97 }
98 98 state.checkedKeys = currentValue;
99 99 } else {
... ... @@ -437,7 +437,11 @@
437 437 {extendSlots(slots)}
438 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 445 <ScrollContainer style={scrollStyle} v-show={!unref(getNotFound)}>
442 446 <Tree {...unref(getBindValues)} showIcon={false} treeData={treeData.value} />
443 447 </ScrollContainer>
... ...