(vue)el-table表格编辑时回显返回的已勾选的数据
tableData数据:
el-table
ref="multipleTable"
:data="tableData"
...
>
...
<el-table-column prop="result" label="相关.." align="center" width="220">
<template slot-scope="scope">
{{ scope.row.result === 'NaN' ? '-' : scope.row.result }}
</template>
</el-table-column>
</el-table>
aa(){
...
//返回数据
const selectedRows = [{parametersName: "...重量", result: "NaN"}]
this.tableData.forEach(item => {
selectedRows.forEach(e => {
if (e.parametersName === item.parametersName) {
this.$nextTick(() => {
this.$refs.multipleTable.toggleRowSelection(item)
})
}
})
})
}
解决参考:https://blog.csdn.net/m0_73393602/article/details/134883201