mirror of https://github.com/openspug/spug
U 主机分组5个以上时不再默认展开
parent
d2f3b105a6
commit
db268b7635
|
@ -36,7 +36,8 @@ export default observer(function () {
|
||||||
}, [loading])
|
}, [loading])
|
||||||
|
|
||||||
useEffect(() => {
|
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)
|
const tmp = store.treeData.filter(x => x.children.length)
|
||||||
setExpands(tmp.map(x => x.key))
|
setExpands(tmp.map(x => x.key))
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default observer(function (props) {
|
||||||
<Row gutter={12}>
|
<Row gutter={12}>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Tree.DirectoryTree
|
<Tree.DirectoryTree
|
||||||
defaultExpandAll
|
defaultExpandAll={store.treeData.length > 0 && store.treeData.length < 5}
|
||||||
expandAction="doubleClick"
|
expandAction="doubleClick"
|
||||||
selectedKeys={[group.key]}
|
selectedKeys={[group.key]}
|
||||||
treeData={store.treeData}
|
treeData={store.treeData}
|
||||||
|
|
|
@ -226,7 +226,7 @@ function WebSSH(props) {
|
||||||
<Button icon={<SyncOutlined/>} type="link" loading={fetching} onClick={fetchNodes}/>
|
<Button icon={<SyncOutlined/>} type="link" loading={fetching} onClick={fetchNodes}/>
|
||||||
{treeData.length > 0 ? (
|
{treeData.length > 0 ? (
|
||||||
<Tree.DirectoryTree
|
<Tree.DirectoryTree
|
||||||
defaultExpandAll
|
defaultExpandAll={treeData.length > 0 && treeData < 5}
|
||||||
expandAction="doubleClick"
|
expandAction="doubleClick"
|
||||||
treeData={treeData}
|
treeData={treeData}
|
||||||
icon={renderIcon}
|
icon={renderIcon}
|
||||||
|
|
Loading…
Reference in New Issue