1. Home
  2. Vue
  3. For loop

Directive "v-for" loops through an array and lets you output a new HTML element for each loop iteration.

#vue#loop#directive
<ul id="app">
    <li v-for="code in codes">{{ code }}</li>
</ul>

<script>
    new Vue({
        el: 'app',
        data: {
            codes: ['Javascript', 'HTML', 'CSS', 'PHP']
        }
    })
</script>
copy
Full Vue cheatsheet