15.vue中的循环指令

<!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>Document</title>
</head>
<body>
    <div id="app">
        <h3 v-for="(n,index) in 3">{{n}} - {{index}}</h3>
        <h4 v-for="(user,index) in userList">name:{{user.name}} - age:{{user.age}}</h4>
    </div>
    <script src="vue.min.js"></script>
    <script>
        new Vue({
            el:'#app',
            data: {
                userList: [
                    {name:'hh',age:11},
                    {name:'er',age:22},
                    {name:'rr',age:88}
                ]
            },
            methods: {
                
            }
        })
    </script>
</body>
</html>
发布了253 篇原创文章 · 获赞 10 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/gunsmoke/article/details/105277112
今日推荐