element-ui表单初始化校验报红

2023-08-19  本文已影响0人  泪滴在琴上

在开发中,我们经常会遇到element-ui表单回显,初始化页面就报红的情况

解决方法:

回显赋值的时候,加上以下代码就好啦

for (const key in this.baseinfo) {
  if (!this.baseinfo[key]) {
    this.baseinfo[key] = ''
  }
}
this.$nextTick(() => {
  this.$refs['editForm'].clearValidate()
})
上一篇 下一篇

猜你喜欢

热点阅读