为了账号安全,请及时绑定邮箱和手机立即绑定

VUE.js调用后端数据使用v-for时报错未定义?

VUE.js调用后端数据使用v-for时报错未定义?

慕粉18341035298 2020-02-02 20:50:56
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 回答
  • 0 关注
  • 1260 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信