I wrote it basically as a theory. Mainly business code is trival and complex, difficult to thoroughly understand all on my own Now write a practical, a recent project, without use of the code generator and other components, is a blank page allows you to write in primary form, need to implement several functions, all, all pack up, all the choices, deselect, reverse choice
Select the appropriate component first, which is recommended
It is recommended to read through the following method first
deselect
Just copy element’s built-in methods. It smells good
if (rows) { rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row); }); } else { this.$refs.multipleTable.clearSelection(); }},Copy the code
The other two methods are modified on a deselect basis
select all
checkAll() {
this.tableData.forEach(item => {
this.$refs.multipleTable.toggleRowSelection(item, true);
});
},
Copy the code
The selected
Anti – select on the basis of all slightly modified on the line
invertSelection() {
this.tableData.forEach(item => {
this.$refs.multipleTable.toggleRowSelection(item);
});
}
Copy the code
After writing out, I found that it was actually very simple, but I spent a lot of effort to write