mirror of https://github.com/openspug/spug
U 主机分组5个以上时不再默认展开
parent
d2f3b105a6
commit
db268b7635
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue