table 添加 ref="refTable" 引用 该table
table 添加 @row-click="clickTable" 点击事件
点击时,调用table的方法 toggleRowExpansion ,展开/关闭
template:
<el-table :data="list" style="width: 100%" ref="refTable" @row-click="clickTable">
script:
methods: {
clickTable(row,index,e){
//调用,table的方法,展开/折叠 行
this.$refs.refTable.toggleRowExpansion(row)
}
}