VUE.js调用后端数据使用v-for时报错未定义?
1.v-for使用 [tr] [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后就失败
###求助各位大佬,帮帮忙啊~~~~ |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|