DIRECTIVES: V-FOR
V-FOR Allows us to “render a list of items based on an array (or object).” <script> const app = new Vue({ el: ‘#app’, data: { Hogwarts: [ ‘Ravenclaw’, ‘Hufflepuff’, ‘Slytherin’, ‘Gryffindor’ ] } }) </script>
<!— Given the data in the Vue instance —> <div id=”app”> <ul> <li v-for=”house in Hogwarts”> {{ house}} </li> </ul> </div> <!— Will be rendered as… —> <ul> <li>Ravenclaw</li> <li>Hufflepuff</li> <li>Slytherin</li> <li>Gryffindor</li> </ul> </template>