el-table點擊button獲取所有選中狀態復選框的值

1、<el-table>標簽寫入 ref="multipleTable"

2、<el-table-column>標簽寫入 type="selection"

3、<el-button>標簽寫入 @click=""

4、methods中button對應的click事件方法中寫入 this.$refs.multipleTable.selection

<el-table :data="tableData" ref="multipleTable">
  <el-table-column type="selection" width="50"></el-table-column>
  <el-table-column label="Key" property="key" width="300">
    <template slot-scope="scope">
      <el-input v-model="scope.row.key" placeholder="請輸入key"/>
    </template>
  </el-table-column>
  <el-table-column label="Value" property="value" width="300">
    <template slot-scope="scope">
      <el-input v-model="scope.row.value" placeholder="請輸入Value"/>
    </template>
  </el-table-column>
</el-table>
<el-button type="primary" @click="tj()">提交</el-button>


methods:{
  tj(){
      console.log(this.$refs.multipleTable.selection)
    }
}
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。