<publicTable
ref="publicTable"
class="table"
:table-data="tableData"
:table-info="tableInfo"
:table-column="columns"
:events="events"
:is-need-pagination="false"
:has-operation="false"
:loading="loading"
:need-select="true"
>
el-table组件的封装_el-table封装-CSDN博客
events: {
'selection-change': selection => {
if (selection.length > 1) {
const newRows = selection.filter((it, index) => {
if (index == selection.length - 1) {
this.$refs.publicTable.$refs.tableData.toggleRowSelection(it, true)
return true
} else {
this.$refs.publicTable.$refs.tableData.toggleRowSelection(it, false)
return false
}
})
this.selectionList = newRows
} else {
this.selectionList = selection
}
},
select: (selection, row) => {
this.$refs.publicTable.$refs.tableData.clearSelection()
this.$refs.publicTable.$refs.tableData.toggleRowSelection(row, true)
this.$refs.publicTable.$refs.tableData.setCurrentRow(row)
this.selectionList = []
this.selectionList.push(row)
}
}