Closed erguotou520 closed 8 years ago
Thank you for your reporting!!
You can avoid this issue with detect-blur="off"
.
Ok, got it.
It will also disable the touched
state if add the detect-blur
attr, this is not good. I still need the dirty
, modified
, touched
check.
The vue-validator should not disable the touched
because occur runtime error when is re-rendering if use the touched
in the template.
The other is the same.
So when set detect-blur="off"
the $validation.touched
will be always false
?
yeah!
the $validation.touched
become always false
It's not well I think.
Why do you think incorrect about it ? Please tell me detail explanation.
If the error text dom wrote like this <span v-show="$validation.foo.touched&&$validation.foo.exist">It is existed, please try another one.</span>
, and exist
validation is a async check function which check the field's value is existed.
So when users focus on the input, typed something and then blur, then focus then blue which nothing typed, you will find there are two duplicated exist
check. This is not I want. The better way is when input field value is valid
then do async check. And duplicated value again? No check again.
vue & vue-validator version
vue: 1.0.24 vue-validator: 2.1.1
Reproduction Link
https://jsfiddle.net/kvmrLvw9/1/
Steps to reproduce
$validation.foo.exist
to betrue
What is actually happening?
The
$data.validators.exist
function called again while the data not changed, and we can't judge whether the input value is modified. So this will call a duplicated ajax validation.What is Expected?
If the field not changed, do not call the function again or we can judge whether it is modified.