(vue)el-table表格回显返回的已勾选的数据

(vue)el-table表格编辑时回显返回的已勾选的数据


tableData数据:


c 复制代码
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>
c 复制代码
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

相关推荐
excel10 分钟前
webpack 格式化模块 第 三 节
前端
怕冷的火焰(~杰)44 分钟前
虚拟列表react-virtualized使用(npm install react-virtualized)
前端·react.js
云之兕1 小时前
Spring Boot 自动配置原理详解
java·前端·spring boot
好_快1 小时前
Lodash源码阅读-baseSortedIndexBy
前端·javascript·源码阅读
好_快1 小时前
Lodash源码阅读-sortedLastIndex
前端·javascript·源码阅读
好_快1 小时前
Lodash源码阅读-sortedIndexOf
前端·javascript·源码阅读
好_快1 小时前
Lodash源码阅读-sortedLastIndexOf
前端·javascript·源码阅读
好_快1 小时前
Lodash源码阅读-findLastIndex
前端·javascript·源码阅读
好_快1 小时前
Lodash源码阅读-sortedIndex
前端·javascript·源码阅读
Java小白中的菜鸟1 小时前
SSE Emitter在Spring Boot和Vue中的简单使用
前端·vue.js·spring boot