vxe-table的编辑表格只校验临时变动的数据

使用官网上的完整校验

  async fullValidEvent () {
              const errMap = await this.$refs.xTable.fullValidate().catch(errMap => errMap)
              if (errMap) {
                let msgList = []
                Object.values(errMap).forEach(errList => {
                  errList.forEach(params => {
                    let { rowIndex, column, rules } = params
                    rules.forEach(rule => {
                      msgList.push(`第 ${rowIndex} 行 ${column.title} 校验错误:${rule.message}`)
                    })
                  })
                })
                this.$XModal.message({
                  status: 'error',
                  slots: {
                    default () {
                      return [
                        <div class="red" style="max-height: 400px;overflow: auto;">
                          {
                            msgList.map(msg => <div>{ msg }</div>)
                          }
                        </div>
                      ]
                    }
                  }
                })
              } else {
                this.$XModal.message({ status: 'success', message: '校验成功!' })
              }
            }

表格第一次校验的时候,做了整体校验,校验不通过,当有添加行或者删除行的时候,便只校验操作行,便校验通过了。
原因:

解决:只需要加上fullValidate()方法加上true即可
  const errMap = await this.$refs.xTable.fullValidate(true).catch(errMap => errMap)

最近更新

  1. TCP协议是安全的吗?

    2024-04-21 18:38:08       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-21 18:38:08       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-21 18:38:08       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-21 18:38:08       20 阅读

热门阅读

  1. web大型工程项目架构以及搭建

    2024-04-21 18:38:08       16 阅读
  2. linux中ssh远程登陆

    2024-04-21 18:38:08       14 阅读
  3. Golang面试题五(GC)

    2024-04-21 18:38:08       18 阅读
  4. 动态库的制作和使用

    2024-04-21 18:38:08       15 阅读
  5. c++IO

    c++IO

    2024-04-21 18:38:08      14 阅读
  6. 什么是ProxySQL?

    2024-04-21 18:38:08       30 阅读
  7. 华为OD-C卷-执行任务赚积分[100分]C++ 100%

    2024-04-21 18:38:08       18 阅读