Home » vue » Vue js v-repeat not showing anything

Vue js v-repeat not showing anything

Posted by: admin November 26, 2021 Leave a comment

Questions:

I am totally new to vue.js. I am trying to repeat a simple list but its not showing anything. My code is

<html>
    <head>
        <title>VUE Series</title>
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    </head>
    <body>
        <div class="container">
            <div id="tasks">
                <div>
                    <h2>Tasks</h2>
                    <ul class="list-group">
                        <li v-repeat="tasks"> {{ $value }} </li>
                    </ul>    
                </div>
            </div>
        </div>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.28/vue.min.js"></script>
        <script src="app.js"></script>
    </body>
</html>

and app.js file is :

new Vue({
    el : '#tasks',

    data : {
        tasks : ['Assam', 'Manipur', 'Meghalaya']
    }
})

Fiddle link is FIDDLE

Answers:

You should use v-for instead of v-repeat and the syntax should be v-for="task in tasks"and you use taskto reference the current task.