<body>
<div id="vue-app">
<h1>v-if 条件</h1>
<!-- 遍历数组 -->
<ul>
<li v-for="food in foods">
{{ food }}
</li>
</ul>
<ul>
<li v-for="(user,index) in users">
{{ index+1 }}. {{ user.name }} : {{ user.age }}岁
</li>
</ul>
<template v-for="(user,index) in users">
<h1>{{ index+1 }}. {{ user.name }}</h1>
<p>Age:{{ user.age }}岁</p>
</template>
<template v-for="(user,index) in users">
<div v-for="(val,key) in user">
<p>{{ key }} - {{ val }}</p>
</div>
</template>
</div>
</body>
new Vue({
el: "#vue-app",
data: {
foods: ["apple", "banana", "candy"],
users: [
{ name: "Joe", age: 20 },
{ name: "Mark", age: 15 },
{ name: "York", age: 30 },
]
},
})
此页面不支持夜间模式!
已进入夜间模式!
已进入普通模式!
搜索框不允许为空
签到成功!经验+5!芋圆币+2!
签到失败!今日已签到!
需要登录社区账号才可以进入!