zoukankan      html  css  js  c++  java
  • 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;
             }
       })
    

      

      

  • 相关阅读:
    Docker
    Docker
    Docker
    Docker
    Docker
    Docker
    pandas——向已经存在的excel数据写入data
    python——利用UI选择路径
    python——装饰器的使用
    python——生成器(协程)gevent多任务
  • 原文地址:https://www.cnblogs.com/theblogs/p/15093158.html
Copyright © 2011-2022 走看看