Skip to content
Related Articles

Related Articles

v-for Directive in Vue.js
  • Last Updated : 25 Jun, 2020

v-for directive is a Vue.js directive used to loop over a data usually an array or object. First, we will create a div element with id as app and let’s apply the v-for directive to an element with data. Now we will create this data by initializing a Vue instance with the data attribute containing the value.


v-for="data in datas"

Parameters: This function accepts data which is either an array or object over which we will loop over.

Example: This example uses Vue.js to loop over an array with v-for.

<!DOCTYPE html>
        VueJS | v-for directive
    <!-- Load Vuejs -->
    <script src=
    <div style="text-align: center;
        width: 600px;">
        <h1 style="color: green;">
            VueJS | v-for directive
    <div id="canvas" style=
        "border:1px solid #000000;
        width: 600px;height: 200px;">
        <div id="app">
            <h2 v-for="data in datas">
        var app = new Vue({
            el: '#app',
            data: {
                datas: [



My Personal Notes arrow_drop_up
Recommended Articles
Page :