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);
          });
posted on 2020-11-11 19:09  忆小样  阅读(1082)  评论(0编辑  收藏  举报