问题描述
项目中遇到一个el-table回显勾选的问题
问题出现的环境背景及自己尝试过哪些方法
vue2 + element-ui
相关代码
回显时使用的方法
echoData(){
this.opeartionList.forEach(item=>{
this.$nextTick(() => {
if (this.form.cNameList.includes(item.id)) {
this.$refs.tabOpRefOpear && this.$refs.tabOpRefOpear.toggleRowSelection(item);
}
});
})
},
你期待的结果是什么?实际看到的错误信息又是什么?
回显不生效,没有报错,应该是这个方法有问题
结合描述与代码来看,推测问题可能出在echoData方法调用的时机上以及nextTick写在了循环内.
确保你在处理回显时已经拿到cNameList数据及opeartionList数据.建议async & await 处理请求.