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([])//置空選中節點