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