>}
showIcon={true}
expandedKeys={unfolds}
autoExpandParent={autoExpandParent}
onSelect={(selectedKeys, e) => {
let key = e.node.props.eventKey;
if (unfolds.length === 0) {
setUnfolds(selectedKeys)
return;
}
if (e.node.props.hasOwnProperty('children') && !unfolds.includes(key)) {
//展开
unfolds.push(key)
} else if (e.selectedNodes.length > 0 && !e.selectedNodes[0].props.children) {
// 最后一层
setNowSelect(key)
} else if (unfolds.includes(key)) {
// 收缩
let index = unfolds.indexOf(key)
unfolds.splice(index, 1)
}
setUnfolds(unfolds)
setAutoExpandParent(false)
}}>
{recursion(props.treeStructure)}
)
}
.left {
background : rgba(255, 255, 255, 1);
border-radius: 3px 3px 3px 3px;
height : 100%;
flex : 0 0 250px !important;
max-width : 250px !important;
overflow : hidden;
.keyword {
margin : 20px 0 10px;
padding: 0 13px;
height : 36px;
input {
border-radius: 18px;
padding-left : 16px;
}
span {
font-size: 20px;
right : 30px;
}
}
:global(.ant-tree-node-content-wrapper-close) {
:global(.anticon-minus-circle) {
display: none;
}
}
:global(.ant-tree-node-content-wrapper-open) {
:global(.anticon-plus-circle) {
display: none;
}
}
:global(.ant-tree) {
li {
:global(.ant-tree-node-content-wrapper.ant-tree-node-selected) {
background: #fff !important;
color : #000000 !important;
}
:global(.ant-tree-node-content-wrapper) {
color: #000000;
&:hover {
background: #fff !important;
color : #409EFF !important;
}
}
}
}
}
因为数据量大,可能会接口比较慢,或者这边生成时间比较长,加一个Spin组件,用户体验会好点。