ant vue tree沒數據時候取消懶加載箭頭


 

機構懶加載,選人時候,如果該機構下面沒人,就取消加載並且不顯示箭頭

<a-tree
     checkable
     :load-data="onloadData"
     @check="onCheck"
     :tree-data="treeData"
     :replace-fields="replaceFields"
     :loadedKeys="loadedKeys"
     :expandedKeys="expandedKeys"
     @expand="onExpand"
>

  

//異步加載數據
onloadData(treeNode) {
    return new Promise((resolve,reject)=>{
         let taskId = treeNode.dataRef.id;
         if (treeNode.dataRef.meta == 1) {
             taskId = taskId ? taskId.substr(2, taskId.length) : ""; 
             console.log('treeNode.dataRef.children', treeNode);
             commonApi.subOrgAndUserTreeNode(taskId).then((data) => {
                  if (data.length > 1) {               
                   treeNode.dataRef.children.splice(0,treeNode.dataRef.children.length)
                      treeNode.dataRef.children = data;
                      this.treeData = [...this.treeData];
                   } else {
                       treeNode.dataRef.isLeaf = true;
                       this.treeData = [...this.treeData];
                    }
             }).finally(() => { resolve() });
        } else {
             resolve();
              return;
         }
   })

  

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM