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