<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="app">
<ul>
<!--遍历数组-->
<li v-for="(item,index) in arr">item:{{item}}<br>index:{{index}}</li>
</ul>
<ul>
<!--对象的遍历-->
<li v-for="(value,key,index) in qwq">{{value}}<br>{{key}}<br>{{index}}</li>
</ul>
<ul>
<!--名字的遍历 后端传来的-->
<li v-for="(item,index) in qop">{{item.name}}</li>
</ul>
</div>
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>
<script>
new Vue({
el:"#app",
created(){
fetch('http://jsonplaceholder.typicode.com/users')
.then(res=>{
return res.json()
}).then(data=>{
this.qop = data;
console.log(this.qop);
})
},
data(){
return {
arr:["qqq","www","eee"],
qwq:{
name:"knight",
age:18,
sex:"nan",
address:"moue"
},
qop:[]
}
}
})
</script>
</body>
</html>
Python3Turtle