table添加事件expand-change
<el-table ref="table" @expand-change="expandChange" :data="tableData" row-key="id" lazy :load="load" :tree-props="treeProps"></el-table>
expandChange(row,expanded){ // console.log(row) if(expanded){ let $table = this.$refs.table; for(let i = 0;i < this.tableData.length;i++){ if(row[‘id‘] !== this.tableData[i][‘id‘]){ $table.toggleRowExpansion(this.tableData[i],false); } } } },
原文:https://www.cnblogs.com/xiongK/p/13488832.html