Closed BrainOverfloW closed 8 years ago
You can avoid this issue with the the below:
<p v-if="$form['name' + $index] && $form['name' + $index].required">Please enter a number.</p>
The validation results is added the dynamically, also is removed.
This issue is occuring because v-if
have priority over other directives.
I recommend use the validator-errors
.
http://vuejs.github.io/vue-validator/en/errors.html
vue & vue-validator version
1.0.17, 2.0.0-beta.1
When using the validator on a element within a v-for, removing data in the list makes the validator crash. Only removing the last item in the list works properly. This seems to be related with the $index not matching the elements in the validator after an element gets removed.
Reproduction Link
https://jsfiddle.net/oc6ccx4u/
Steps to reproduce
Delete an element, used in a v-for, that has a validator element.
What is Expected?
The remaining items in the list should still have their validation running.
What is actually happening?
The validator crashes with the the error: Error when evaluating expression "$form['name' + $index].required": TypeError: Cannot read property 'required' of undefined"