element-ui树结构设置默认选中节点时改变传入的数组树结构没有变化


1.选中默认节点

:default-checked-keys="authorities"

2.改变传入的数组

detail.authorities.map(item => {
          if (this.authorities.indexOf(item.id) === -1) {
            this.authorities.push(item.id)
          }
        })

3.使用树结构方法

this.$refs.roleTree.setCheckedKeys(this.authorities)//设置默认选中节点 使用时一定要给树结构设置node-key 根据node-key设置选中或置空
this.$refs.roleTree.setCheckedNodes([])//置空选中节点

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM