mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-29 16:06:07 +08:00
修正树节点选中,父节点自动展开
This commit is contained in:
parent
dced95c497
commit
aed389c17b
|
@ -115,10 +115,11 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
|
||||||
node: {
|
node: {
|
||||||
title: s,
|
title: s,
|
||||||
value: s,
|
value: s,
|
||||||
key: `${p}-${s}`,
|
key: p ? `${p}-${s}` : s,
|
||||||
parent: p,
|
parent: p,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
setExpandedKeys([p]);
|
||||||
onTreeSelect([`${p}-${s}`], obj);
|
onTreeSelect([`${p}-${s}`], obj);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -136,6 +137,10 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
|
||||||
getDetail(node);
|
getDetail(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onExpand = (expKeys: any) => {
|
||||||
|
setExpandedKeys(expKeys);
|
||||||
|
};
|
||||||
|
|
||||||
const onTreeSelect = useCallback(
|
const onTreeSelect = useCallback(
|
||||||
(keys: Key[], e: any) => {
|
(keys: Key[], e: any) => {
|
||||||
const content = editorRef.current
|
const content = editorRef.current
|
||||||
|
@ -468,6 +473,8 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
|
||||||
showIcon={true}
|
showIcon={true}
|
||||||
height={height}
|
height={height}
|
||||||
selectedKeys={[select]}
|
selectedKeys={[select]}
|
||||||
|
expandedKeys={expandedKeys}
|
||||||
|
onExpand={onExpand}
|
||||||
showLine={{ showLeafIcon: true }}
|
showLine={{ showLeafIcon: true }}
|
||||||
onSelect={onTreeSelect}
|
onSelect={onTreeSelect}
|
||||||
></Tree>
|
></Tree>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user