vue+elment el-tree懒加载自定义叶子节点,三角样式最后一层不显示css

<el-tree lazy :load="loadNode" :data="treeData" :props="defaultProps" node-key="id" @node-click="handleNodeClick">
  <span slot-scope="{ node, data }" class="span__">
      <i v-if="data.icon" class="iconfont" :class="data.icon" />
      <span class="tree-node-span">{{ node.label }}span>
  span>
el-tree>      
data() {
        return {
            props: {
               label: "name",
              isLeaf: (data, node) => {
                if (node.level === 2) {
                     return true
                }
           	  }
          },
     }
}
Node(node, resolve) {
            //如果展开第一级节点,从后台加载一级节点列表
            if (node.level == 0) {
                this.loadfirstnode(resolve);
            }
            //如果展开其他级节点,动态从后台加载下一级节点列表
            if (node.level >= 1) {
                this.loadchildnode(node, resolve);
            }
        },
        async loadfirstnode(resolve) {
            const res = await getGroupList() //getGroupList()api接口
            res.rows.map(item => {
                item.flag = 1
            })
            return resolve(res.rows)
        },
        async loadchildnode(node, resolve) {
            let page = { pageNum: 1, pageSize: 9999, groupid: node.data.id }
            const res = await getnNoGrupListEq(page)  //getnNoGrupListEq(page) api接口
            res.rows.map(item => {
                item.icon = "icon-menci"
                item.flag = 2
            })
            return resolve(res.rows)
        },

//el-tree三角样式最后一层不显示
.treeSection {
    ::v-deep {
        .el-tree-node__label {
            font-size: 16px;
            color: #333333;
            font-weight: 600;
        }
        ::-webkit-scrollbar-thumb {
            background-color: rgba(60, 156, 200, 0.4);
            background-clip: padding-box;
            border: 3px solid transparent;
            border-radius: 7px;
        }
        .is-leaf::before {
            // 隐藏或加透明都可以
            // display: none;
            opacity: 0;
        }
        .el-tree-node__content > .el-tree-node__expand-icon {
            padding: 0;
        }
    }
    .showName {
        font-size: 16px;
        color: #333333;
        font-weight: 600;
    }
}

你可能感兴趣的:(前端,javascript,vue.js,css,elementui)