U 主机分组5个以上时不再默认展开

pull/517/head
vapao 2022-06-27 18:22:01 +08:00
parent d2f3b105a6
commit db268b7635
3 changed files with 4 additions and 3 deletions

View File

@ -36,7 +36,8 @@ export default observer(function () {
}, [loading])
useEffect(() => {
if (store.treeData.length > 0 && expands === undefined) {
const length = store.treeData.length
if (length > 0 && length < 5 && expands === undefined) {
const tmp = store.treeData.filter(x => x.children.length)
setExpands(tmp.map(x => x.key))
}

View File

@ -95,7 +95,7 @@ export default observer(function (props) {
<Row gutter={12}>
<Col span={6}>
<Tree.DirectoryTree
defaultExpandAll
defaultExpandAll={store.treeData.length > 0 && store.treeData.length < 5}
expandAction="doubleClick"
selectedKeys={[group.key]}
treeData={store.treeData}

View File

@ -226,7 +226,7 @@ function WebSSH(props) {
<Button icon={<SyncOutlined/>} type="link" loading={fetching} onClick={fetchNodes}/>
{treeData.length > 0 ? (
<Tree.DirectoryTree
defaultExpandAll
defaultExpandAll={treeData.length > 0 && treeData < 5}
expandAction="doubleClick"
treeData={treeData}
icon={renderIcon}