<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id='app'>
<ul>
<li v-for="(value,key,index) in obj">{{key}}:{{value}}:{{index}}</li>
</ul>
<div v-for="(value,index) in fruits">{{value}}:{{index+1}}</div>
</div>
</body>
</html>
<script src="node_modules/vue/dist/vue.js"></script>
<script>
let vm = new Vue({
el: '#app',
data: {
obj:{name:'zfpx',age:9,address:'xxx'},
fruits:[{name:'zhu'},{name:'feng'},{name:'px'}]
},
methods: {}
})
</script>
v-for 数组的循环
最新推荐文章于 2022-09-21 21:02:40 发布