<!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=edfe"> <script src="https://unpkg.com/vue@3.3.4/dist/vue.global.js"></script> <title>v-for</title> </head> <body> <div id="app"> <h2>v-for遍历数组</h2> <ul> <li v-for="(item,index) in arr" :title="item"> {{ index + 1 }} - {{ item }} </li> </ul> <h2>v-for遍历数组对象</h2> <ul> <li v-for="(item, index) in arr_obj" :title="item.system"> {{ index + 1 }} - {{ item.system }} </li> </ul> </div> <script type="text/javascript"> const App = { data() { return { arr: ['华为', '苹果', 'Oppo', '小米', 'Vivo'], arr_obj: [ {system: 'iOS'}, {system: 'Android'}, {system: '鸿蒙'}, ] } } } Vue.createApp(App).mount("#app") </script> </body> </html>