v-for循环数字数组

版权声明:一家之言,看完就忘了吧 https://blog.csdn.net/leisure_life/article/details/83901933
<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X_UA-Compatible" content="ie=edge">
    <title>vue 入门</title>
    <!--1 导入vue.js库-->
    <script src="./lib/vue.js"></script>
</head>

<body>
    <div id="app">
        <p v-for="(item,i) in list">下标值:----{{i}}---每一项的值-----{{item}}</p>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: { 
                list:[1,2,3,4,5]
            },
            methods: {

            }
        })

    </script>
</body>

</html>

猜你喜欢

转载自blog.csdn.net/leisure_life/article/details/83901933