List Rendering
Learn about list rendering in Vue using the "v-for" directive.
We'll cover the following...
Vue.js provides the functionality to map HTML elements into lists in the data
. Mapping elements to lists means that if you want to display a list on the webpage, you do not have to manually refer to each of the list elements separately. There can be multiple scenarios where you need to display a list of strings such as ToDo lists or you may need to display details of objects that are also stored as objects in data
. Therefore, the list rendering comes in handy.
v-for
directive
List rendering is performed using the v-for
directive. The v-for
directive used with an HTML element binds itself to an array in data
. This is performed using v-for="item in items"
which resembles for each loop syntax. It duplicates the same HTML element for all iterations of the loop and for all elements of the array. The following is a simple and ...