Vuelidate "OR" 验证器示例
Vuelidate "OR" validator example
好的 - 搜索了很长时间,但找不到示例或使用 Vuelidate 的 OR 验证器。 this github issue is not valid and the issue resolves without providing a valid OR example. The docs mention it exists 中提到的那个,但没有我们可以找到的任何示例。任何人都有或知道一个有效的例子吗?
如果您想要一个采用多种验证类型的字段,例如使用用户名或电子邮件地址登录,您可以这样做
data () {
return { {
multiusername: '',
}
},
validations: {
multiusername: {
required,
mycustomval: or(email, alphaNum)
}
}
好的 - 搜索了很长时间,但找不到示例或使用 Vuelidate 的 OR 验证器。 this github issue is not valid and the issue resolves without providing a valid OR example. The docs mention it exists 中提到的那个,但没有我们可以找到的任何示例。任何人都有或知道一个有效的例子吗?
如果您想要一个采用多种验证类型的字段,例如使用用户名或电子邮件地址登录,您可以这样做
data () {
return { {
multiusername: '',
}
},
validations: {
multiusername: {
required,
mycustomval: or(email, alphaNum)
}
}