el-table-column type="expand" 下拉展开始终只展开一行


<el-table :data="tableData" @expand-change="expandChange" ref="refTable">
<el-table-column type="expand">
</el-table-column>
<el-table>

expandChange(row,expandedRows){
      var that = this
      if (expandedRows.length>1) {
          that.expands = []
          if (row) {
              that.expands.push(row);
          }
          this.$refs.refTable.toggleRowExpansion(expandedRows[0]);
      } else {
          that.expands = [];
      }
    },

主要就是使用el-table的@expand-change方法,并添加ref

注:记得在data中定义变量expands

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM