Vue-v-for

<!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">
        <!--遍历10,插值表达式取值 n-->
       <ul v-for="n in 10">
           <li>{{n}}</li>
       </ul>
        <!--遍历10,插值表达式取值 n index 为索引值-->
        <ol v-for="(n,index) in 10">
            <li>{{n}}---{{index}}</li>
        </ol>
       
        <ul v-for="n in userList">
            <li>{{n.id}}{{n.name}}{{n.age}}</li>
        </ul>

    </div>
    <script src="vue.min.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                userList:[
                    {id:1,name:"小明",age:19},
                    {id:2,name:"小红",age:19},
                    {id:2,name:"小宁",age:40}
                ]
            }
        })
    </script>
</body>

</html>

 

posted @ 2020-09-29 22:14  KwFruit  阅读(83)  评论(0编辑  收藏  举报