<el-table
:data="tableData"
style="width: 100%"
// 以下三项必写
:row-key="getRowKeys"
:expand-row-keys="expands"
@row-click="clickRowHandle"
>
// date中
expands: []
// 根据行的id判断
getRowKeys(row) {
return row.id;
},
clickRowHandle(row, column, event) {
if (this.expands.includes(row.id)) {
this.expands = this.expands.filter(val => val !== row.id);
} else {
this.expands.push(row.id);
}
},