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="(item, index) in list" :key="index">索引是{{index}},值是{{item}}</p>
    13. </div>
    14. <script>
    15. var vm=new Vue({
    16. el:'#app',
    17. data:{
    18. list:[1,2,"c",4,5,6]
    19. },
    20. methods:{}
    21. });
    22. </script>
    23. </body>
    24. </html>

    image.png