问答

vue + element table的树型表格的实现

作者:admin 2021-07-23 我要评论

我想要根据 sonList 这个字段来实现,但是不清楚js应该怎么绑定 这是我写的html部分,有很多错误 我拼凑的。。 el-table :data="list" v-loading="listLoading" ...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

我想要根据sonList这个字段来实现,但是不清楚js应该怎么绑定
这是我写的html部分,有很多错误 我拼凑的。。

<el-table
        :data="list"
        v-loading="listLoading"
        element-loading-text="Loading"
        fit
        highlight-current-row
        row-key="list.requireCode"
        border
        default-expand-all
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >
         <el-table-column label="名称" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.requireName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="代码" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.requireCode }}</span>
          </template>
        </el-table-column>
        <el-table-column label="类型" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.requireType }}</span>
          </template>
        </el-table-column>
        <el-table-column label="字段名" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{ scope.row.fieldName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-link :underline="false" @click="rowClick(scope.row)">
              <i class="el-icon-edit" />
            </el-link>
            <el-link
              :underline="false"
              @click.stop="deleteRequire(scope.$index, scope.row)"
            >
              <i class="el-icon-delete" />
            </el-link>
          </template>
        </el-table-column>
      </el-table>

这是其中的一条数据:
image.png

###
<el-table
        :data="list"
        v-loading="listLoading"
        element-loading-text="Loading"
        fit
        highlight-current-row
        row-key="list.requireCode"
        border
        default-expand-all
        :data="sonList"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >

这里添加 :data="sonList"。建议亲好好看下element文档

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • vue + element table的树型表格的实现

    vue + element table的树型表格的实现

  • windows10 Docker启动不了

    windows10 Docker启动不了

  • php框架的ORM 是否能屏蔽MySQL数据库高

    php框架的ORM 是否能屏蔽MySQL数据库高

  • Netty Client在什么时候会进行EventLoo

    Netty Client在什么时候会进行EventLoo

腾讯云代理商
海外云服务器