![](https://i-blog.csdnimg.cn/blog_migrate/d20485ea32d7dbc63969b0b60185fc3f.png)
data(){
return{
treeBudgetSelect:[],
budgetIds:[3,4]
}
}
methods:{
this.setDisabled(this.treeBudgetSelect, this.budgetIds)
// 已经选择的不能编辑
setDisabled(treeData, key) {
key.forEach(k => {
const loop = (data) => {
for (const item of data) {
if (item.treedataid === k) {
item.disabled = true
break
}
if (item.childList && item.childList.length) {
loop(item.childList)
},
}
}
loop(treeData)
})
},
}