本文主要是【Vue】——Vue遍历数组、对象元素的文章,如果有什么需要改进的地方还请大佬指出⛺️
作者简介:大家好,我是听风与他
☁️博客首页:CSDN主页听风与他
每日一句:狠狠沉淀,顶峰相见
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Documenttitle>
<script src="https://unpkg.com/vue@3/dist/vue.global.js">script>
head>
<body>
<div id="Application">
<div v-for="item in list">
{{item}}
div>
<div v-for="item in k">
{{item.name}}
{{item.num}}
div>
div>
<script>
const App = {
data(){
return{
list:[1,2,3,4,5],
k:[
{
name:'辉少',
num:'151xxxxxxxxx'
},
{
name:'刘少',
num:'151xxxxxxxxx'
},
{
name:'张少',
num:'151xxxxxxxxx'
},
{
name:'李少',
num:'151xxxxxxxxx'
},
]
}
}
}
Vue.createApp(App).mount("#Application")
script>
body>
html>