1. Home
  2. Vue
  3. For loop
#vue#loop#directive

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

<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
Sitemap Git repository