Template Syntax: Directives
Learn about the v-for, v-if, and v-bind directives.
Directives
To build any sort of interesting UI, we need to do more than just display simple values. Vue’s template syntax includes directives for looping and conditional display logic, as well as binding HTML attributes to reactive data properties. Directives are attributes we add to DOM elements and components very similar to
The v-for
directive
Thinking back to our example
The v-for
directive allows us to tell Vue that we want a section of our template to be rendered for every item in a collection (which can be an array or an object).
Syntax
Get hands-on with 1400+ tech skills courses.