0
点赞
收藏
分享

微信扫一扫

百川工作手机实现销售管理微信监控系统

343d85639154 2024-07-24 阅读 28

在工作中,可能需要对树状表格进行全部折叠及全部展开,可采用以下方法: 

页面内容如下:

<el-table v-if="refTable" :data="list" row-key="id" :tree-props="{children:'children',hasChildren:'hasChildren'" :default-expand-all="isExpand">
    <el-table-column label="机构名称" prop="attributes.org_name"></el-table-column>
</el-table>

数据格式如下:

    data() {
      return {
        data: [{
          attributes:[org_name:'1'],
          hasChildren: true,
          label: '一级 1',
          children: [{
            attributes:[org_name:'1'],
            hasChildren: true,
            label: '二级 1-1',
            children: [{
              attributes:[org_name:'1'],
              hasChildren: false,
              label: '三级 1-1-1'
            }]
          }]
        }],
      };
    },

具体方法如下:

handleExpand() {
    this.refTable = false
    this.isExpand = !this.ieExpand
    this.$nextTick(() => {
        this.refTable = true
    })
}

 

 

举报

相关推荐

0 条评论