Add `id` to error entries for iteration
See original GitHub issueIt is considered the best practice in Vue.js to define key for v-for
iterations for performance and determinism reasons.
And it is not uncommon to use vuelidate
results this way:
<div class="input-errors" v-for="error of state.v$.classifierId.$errors" v-bind:key="error ">
<div class="error-msg">{{ error.$message }}</div>
</div>
However, currently there is no unique id exposed on error array that could be used for v-bind: key
, and generic error
has to be used, which is against the Vue.js recommendation.
To Reproduce Perform any validation that results in errors.
Expected behavior
There is a unique id
field per entry in $errors
array.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Add id to array of objects - Stack Overflow
You can use the map() function to iterate over your array of objects. n is each of your objects and you can set...
Read more >for...of - JavaScript | MDN - MDN Web Docs
A for...of loop exits when the iterator has completed (the iterator's next() method returns an object containing done: true ). You may also...
Read more >Iterate Through an Object's Keys and Values in JavaScript or ...
entries method. This tutorial walks you through each of these loops to iterate through an object's keys and values. Node.js Series Overview.
Read more >Iterating over jQuery and non-jQuery Objects
Iterating over jQuery and non-jQuery Objects. jQuery provides an object iterator utility called $.each() as well as a jQuery collection iterator ...
Read more >Define iteration paths (sprints) and configure team iterations
Learn how to define the iteration and sprint fields when you assign work items and configure dashboards in Azure DevOps.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PR is up, @shentao will review when he gets some time and we can release it 😃
Yup, that would definitely work!