What is the use of the v-for instruction in Vue
This article mainly introduces what is the use of the v-for instruction in Vue. It is very detailed and has certain reference value. Interested friends must finish reading it!
V-for
Use the v-for command to render according to the traversal array
There are two forms of traversal
/ / use in,index is an optional parameter, indicating the index of the current item / / use of
The following is an example, and in v-for, you have full access to the parent scope properties.
{{parent}}-{{item.text}} var example = new Vue ({el:'#app', data: {parent:' parent scope 'items: [{text:' text 1'}, {text:' text 2'}]}})
Will be rendered as:
Parent scope-text 1 parent scope-text 2 Note: when v-for and v-if are on the same node, v-for has a higher priority than v-if. This means that v-if will run in every v-for loop. That's all of the article "what's the use of v-for instructions in Vue?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!