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.頁(yè)面報(bào)錯(cuò)?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.確認(rèn)已經(jīng)從后端得到了數(shù)據(jù),但是一旦使用v-for后就失敗###求助各位大佬,幫幫忙啊~~~~
VUE.js調(diào)用后端數(shù)據(jù)使用v-for時(shí)報(bào)錯(cuò)未定義?
慕粉18341035298
2020-02-02 20:50:56