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 property
4.确认已经从后端得到了数据,但是一旦使用v-for后就失败
###求助各位大佬,帮帮忙啊~~~~
慕仙8527320
慕斯4360584
慕慕5436299
相关分类