The reason:
The reason is that the official documentation does not explain one detail in the verification rules. If you use the number verification and also use v-model.number, if you have target: ‘blur’ in your original verification rules, you need to remove it.
Solution:
Type: 'number'
{ required: true.type: 'number'.target: 'blur'.message: 'Training points cannot be empty' }
Copy the code
I tried it and it didn’t give an error when I typed it, but it said “xx is not a number”
Final plan:
Then I tried to use logic or | | operators are trying to write a check that can really
{ required: true.type: 'number'.target: 'blur'.message: 'Training points cannot be empty'} | | {required: true.type: 'string'.target: 'blur'.message: 'Training points cannot be empty' }
Copy the code
It is clear that the first solution satisfies us if it is not used for echo