<!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=edge">
<title>vue 入门</title>
<!--1 导入vue.js库-->
<script src="./lib/vue.js"></script>
</head>
<body>
<div id="app">
<p v-for="(user,i) in list">{{user.id}}----{{user.name}}------下标-{{i}}</p>
</div>
<script>
var vm = new Vue({
el: '#app',
data: {
list:[
{id:1,name: 'zs'},
{id:2,name: 'ls'},
{id:3,name: 'ww'},
{id:4,name: 'zl'},
{id:5,name: 'zq'},
]
},
methods: {
}
})
</script>
</body>
</html>
v-for 循环对象数组
最新推荐文章于 2024-08-28 18:19:04 发布