elementui ztree 编辑的时候,回显半选状态的选项,用isLeaf判断
this.$nextTick(() => {
for(let i=data.menuIds.length-1;i>=0;i--){
// console.log("--id--",data.menuIds[i])
// console.log("----",this.$refs.tree.getNode(data.menuIds[i]))
// console.log("----",this.$refs.tree.getNode(data.menuIds[i]).isLeaf)
let isleaf = this.$refs.tree.getNode(data.menuIds[i]).isLeaf
if(isleaf){
// console.log("data.menuIds[i]----",data.menuIds[i])
yesLeafArray.push(data.menuIds[i])
}
}
// console.log("yesLeafArray",yesLeafArray)
this.$refs.tree.setCheckedKeys(yesLeafArray || [], true);
});