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