[英]How to reset the form validation on a create modal?
我不确定在这种情况下我应该做什么。 当我点击+ Rule
时,我称之为 fn()
showAddRuleModal() {
this.showAddRule = true
this.$refs.form.reset()
//reset form values
this.ruleName = ''
this.url = 'https://www.'
this.urlType = 'Single'
this.ruleDetails = []
let ruleDetail = {
attribute_id: '',
operator_id: '',
value: ''
}
this.ruleDetails.push(ruleDetail)
}
正如您在图片中看到的,我成功创建了一条规则,并尝试再添加一条。
正如您所看到的,其他值似乎已重置,但即使我重置this.$refs.form.reset()
,我的ruleName
输入也被检测为错误
我怎样才能阻止这个?
如果我为默认值添加一个空格
this.ruleName = ' '
该错误消失了,但是现在,我的表单 ruleName 包含一个空格。 有效,但不是很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.