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