九、element多選表格實現單選數組
userChoose(selection, row) {
console.log(selection,'selection')
console.log(row,'row')
//clearSelection:用於多選表格,清空用戶的選擇
//此時全部的checkbox處於未勾選,當用戶第一次點擊的時候,selection爲一個數組,裏面存放的爲當前這一行的數據
this.$refs.multipleTable.clearSelection();
//此時selection仍然有值 ,只是勾選狀態不顯示了。
// if (selection.length === 0) {
// return;
// }
//這這裏將這行的狀態又變爲了勾選
this.$refs.multipleTable.toggleRowSelection(row, true);
//用於多選表格,切換某一行的選中狀態,若是使用了第二個參數,則是設置這一行選中與否(selected 爲 true 則選中)
this.billId = row.id;
alert(row.id)
this.code = row.code;
}this