Element ui 分頁記錄選中框
阿新 • • 發佈:2021-06-28
getTableList() { //列表資料查詢 queryRoomAudit(this.tableParameter).then(response => { this.tableData = response.data this.returnTotal = response.total this.toggleSelection(this.multipleSelectionAll[this.tableParameter.pageIndex], this.tableData, 'FJSH_ZJ') //當前頁選中的list,(注意)需使用當前頁tableData,才能選中,比對選中唯一值key}) }, handleCurrentChange(currentPage) { //頁面索引改變時 if (this.multipleSelection.length) { //頁面改變前賦值 this.$set(this.multipleSelectionAll, this.tableParameter.pageIndex, this.multipleSelection) } this.tableParameter.pageIndex = currentPage - 1 this.getTableList() }, toggleSelection(rows, tableData, key) { //記錄值list,當前頁list,用來比較的唯一值key var _this = this if (rows) { this.$nextTick(() => { for (const row of rows) { for (const item of tableData) { if (row[key] === item[key]) { _this.$refs.multipleTable.toggleRowSelection(item,true) } } } }) } else { _this.$refs.multipleTable.clearSelection() } }