<el-table ref="multipleTable" :key="newAppForm.applyType" border stripe :data="tableData" row-key="id" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" /> <el-table-column label="资产编码" prop="eq_code" /> <el-table-column label="设备序列号" prop="serial_no" /> <el-table-column label="设备类型" prop="category" /> <el-table-column label="下发日期" prop="release_date" /> </el-table> el-table 使用 ref、row-key getSelfEquipment().then(res => { this.tableData = res.data }).finally(() => { // 表格回显 this.$nextTick(() => { const id_list = this.multipleSelection.map(item => item.id) const selected_rows = this.tableData.filter((item, index, array) => { return id_list.indexOf(item.id) !== -1 // 勾选的行 }) this.$nextTick(() => { selected_rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row) }) }) }) }) 用 id 匹配已选中的行 参考链接:https://blog.csdn.net/lyxgoodLucky/article/details/139357489 |
|
来自: 化茧成蝶时光机 > 《elementUI》