vue 使用element el-tree 树形控件设置默认节点高亮
<div class='tree'><el-tree :data="treeList" :highlight-current="highLight" ref="treeList" :load="getTree":render-content="renderContent" :expand-on-click-node='false' :defaul...
·
<div class='tree'>
<el-tree :data="treeList" :highlight-current="highLight" ref="treeList" :load="getTree" :render-content="renderContent" :expand-on-click-node='false' :default-expanded-keys='[0]' node-key='id' :props="defaultProps" @node-click="handleNodeClick" lazy></el-tree>
</div>
设置highlight-current为true,设置ref="treeList"
created(){
this.$nextTick(function(){
this.$refs.treeList.setCurrentKey(0); //"treeList"是你自己在树形控件上设置的 ref="treeList" 的名称
})
},
vue created方法中调用setCurrentKey方法设置根节点高亮
更多推荐
已为社区贡献1条内容
所有评论(0)