按钮
javascript
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button
>
table: default-expand-all="isExpandAll"
javascript
<el-table
v-if="refreshTable"
v-loading="loading"
:data="evalNormList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
</el-table>
js
javascript
// 重新渲染表格状态
refreshTable: true,
// 是否展开,默认全部展开
isExpandAll: true,
javascript
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false
this.isExpandAll = !this.isExpandAll
this.$nextTick(() => {
this.refreshTable = true
})
},