9、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;
}