element table点击某一行时,展开当前点击的行

  1. table 添加 ref="refTable" 引用 该table

  2. table 添加 @row-click="clickTable" 点击事件

  3. 点击时,调用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)
            }
}