(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

GitHub 加速计划 / vu / vue
207.53 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:1 个月前 )
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 3 个月前
e428d891 Updated Browser Compatibility reference. The previous currently returns HTTP 404. 4 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐