1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
    7. <title>Document</title>
    8. <script src="./lib/vue.js"></script>
    9. </head>
    10. <body>
    11. <div id="app">
    12. <p v-for="(user, index) in UserObj" :key="index">{{index}} {{user.name}} {{user.age}}</p>
    13. </div>
    14. <script>
    15. var vm=new Vue({
    16. el:'#app',
    17. data:{
    18. UserObj:[
    19. {"name":"zhangsan","age":18 },
    20. {"name":"zhangsan1","age":19},
    21. {"name":"zhangsan2","age":20},
    22. {"name": "zhangsan3", "age": 21}
    23. ]
    24. },
    25. methods:{}
    26. });
    27. </script>
    28. </body>
    29. </html>

    image.png