<input type="text"
v-model="test2"
id="test2"
name="test2"
v-validate="'remoteString'"
/>
<span class="form-error"
v-if="errors.has('test2')">
{{errors.first('test2')}}
</span>
<button @click="test">测试</button>
async test () {
this.$validator.errors.clear()
this.$validator.validateAll().then((result) => {
console.log(result) //falase
console.log(this.$validator)
})
},
Validator.extend('remoteString', {
validate: (value, obj) => {
const reg = new RegExp('\\d+', 'ig')
return reg.test(value)
}
})
```
默认的 require 规则正常,有可能是什么问题? v2 的