1.v-for使用
<tr v-for: ="item in websites" :key='item'>
<!-- <td>{{item.id}}</td>-->
<!-- <td>{{item.name}}</td>-->
<!-- <td>{{item.url}}</td>-->
<!-- <td>{{item.alexa}}</td>-->
<td>{{item.country}}</td>2.script部分import axios from 'axios'
export default {
name: "Websites",
data() {
return {
websites:[
{
id:1,
name:"name",
url:"url",
alexa:10,
country: "test"
},
]
}
},
created(){
const _this=this
axios.get("http://localhost:8080/listWebsites").then(function(resp){
_this.websites=resp.data
})
}
}3.页面报错 Property or method "item" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property4.确认已经从后端得到了数据,但是一旦使用v-for后就失败###求助各位大佬,帮帮忙啊~~~~
添加回答
举报
0/150
提交
取消