ant-design-vue 强制调用校验规则
在适当的时候调用单个字段的调用规则,该调用视为对该字段所有校验规则的手动调用,可以自主把握时间,实现动态校验规则
const _this = this
getUserPage({ username: userName }).then(res => {
const { records } = res
if (records.length > 0) {
this.$nextTick(() => {
_this.isRepeat = true
_this.form.validateFields(['username'], { force: true }) //手动调用字段校验
})
} else {
_this.isRepeat = false
_this.form.validateFields(['username'], { force: true })
}
})