一、效果图
主要代码
<el-tree
:data="personOptions"
:props="defaultProps"
node-key="id" // 必有
:highlight-current="true" // 必有
:current-node-key="currentKey" // 必有
ref="dataConfigTree"
:expand-on-click-node="false"
accordion
nodeChange.isLeaf="true"
:filter-node-method="filterNode"
@current-change="getname"
:default-expanded-keys="expandedList"
></el-tree>
data() {
return{
currentKey: '', //默认选中
expandedList: [], //展开项
defaultProps: {
children: 'childTags',
label: 'name',
},
}
},
this.$refs.tree.setCurrentKey(null); //取消高亮
this.$refs.tree.setCurrentKey(2); //设置高亮
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
getname(node, checkedNodes) {
},
链接: https://blog.csdn.net/weixin_41950674/article/details/124667158
链接: https://www.cnblogs.com/web-aqin/p/14926651.html
链接: https://blog.csdn.net/weixin_42792507/article/details/118677210