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);
          });


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM