关于elementUI中的el-table的default-expand-all不生效问题!

这是默认收起二级的表格
img

希望效果
img

但试了default-expand-all属性完全不生效。

是需要展开所有吗?我试了一下,还是有效果的,只需在el-table组件上添加属性default-expand-all,有两种写法:

<template>
  <!--1. 只写上default-expand-all -->
  <el-table
    :data="tableData"
    style="width: 100%;"
    row-key="id"
    border
    default-expand-all
    :tree-props="{ children: 'children' }"
  >
    <el-table-column prop="id" label="序号"> </el-table-column>
  </el-table>
  <!--2. 动态绑定方式 :default-expand-all='true' -->
  <!-- <el-table
    :data="tableData"
    style="width: 100%;"
    row-key="id"
    border
    :default-expand-all='true'
    :tree-props="{ children: 'children' }"
  >
    <el-table-column prop="id" label="序号"> </el-table-column>
  </el-table> -->
</template>

element-ui版本需要2.9.1之后才可以

img

我的也是不起做用 展开不了

动态的得再el-table上加个v-if=“xianShi”
data里 xianShi:false
然后再查询里加个

this.xianShi = false;
this.$nextTick(()=>{
  this.xianShi = true
})

强刷一下就行了
this.$forceUpdate()都不生效 不知道为啥