elementui分頁記錄,reserve-selection


第一步:
在<el-table></el-table>標簽中加上 :row-key="getRowKeys"

第二步:
在<el-table-column type="selection"></el-table-column>此行加上:reserve-selection="true"

第三步:
在 data() {
return {
multipleSelection:[],//復選框
getRowKeys(row) {//記錄每行的key值
return row.id;
},
select_order_number:'',//表格select選中的條數
select_orderId:[],//表格select復選框選中的id

}
}

第四步:
handleSelectionChange(rows) {//復選框
this.multipleSelection = rows;
this.select_order_number = this.multipleSelection.length;

this.select_orderId = [];
if (rows) {
rows.forEach(row => {
if (row) {
this.select_orderId.push(row.id);
}
});
}
}

第五步:
在<el-table></el-table>標簽中加上 @selection-change="handleSelectionChange" 事件

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM