Bootstrap

vue2 el-table展开行

 在table加

:row-key="getRowKeys"
:expand-row-keys="expands"
 @expand-change="expandChange"


  <el-table-column type="expand" :loading="loading" element-loading-spinner="el-icon-loading">
                  <template slot-scope="props">
                    <div style="margin-left: 100px" v-loading="loading" element-loading-spinner="el-icon-loading">
                      <el-descriptions :column="1">
                        <el-descriptions-item v-for="item in detailInfoItems" :key="item.key" :label="item.title"
                                              style="width: 120px!important;">
                          <div class="formatted-text" v-if="item.key=='session_condition'">{{ item.value }}</div>
                          <div class="formatt-text" v-else>{{ item.value }}</div>
                        </el-descriptions-item>
                      </el-descriptions>
                    </div>
                  </template>
                </el-table-column>



private expands = [];

private getRowKeys(row: any) {
    return row.id;
  }

  private expandChange(id: any) {
    this.loading = true
    if (this.expands.includes(id)) {
      this.expands = this.expands.filter((val) => val !== id);
    } else {
      if (this.expands.length != 0) {
        this.expands.splice(0, this.expands.length);
        this.expands.push(id);
      } else {
        this.expands.push(id);
      }
    }
    this.handleFeatureDetial(id)
  }
;