Vue v-for (CDN)

app.js

new Vue({
    el: "#app-test",
    data: {
       users: [
            {
                id: 0,
                name: "小明",
                age: 23
            },
            {
                id: 1,
                name: "小芳",
                age: 18
            },
            {
                id: 2,
                name: "小华",
                age: 14
            }
        ]
    }
})

index.html


    
  • {{index}}-{{user.name}}

    id:{{user.id}}

    age:{{user.age}}

至于为什么要绑定key,移步至https://www.jianshu.com/p/4bd5e745ce95

你可能感兴趣的:(Vue v-for (CDN))