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

Vue + Laravel:如果元组数据之一中的表单数组中的数据,如何从api挂载数据

Vue + Laravel:如果元组数据之一中的表单数组中的数据,如何从api挂载数据

守着星空守着你 2021-03-29 17:15:40
我有来自API的数据,但无法将数组中的数据设置为vue.js中的this.data这是来自API的data(JSON)你能告诉我这个语法吗{"id":1613,"name_org":"US company","picture":"default.jpg","headerpic":"no-preview.png","description":null,"address":null,"type":"hardware,software,network","rating":0,"created_at":"2019-03-27 18:50:51","updated_at":"2019-03-27 18:50:51","review":[{       "review_id":3,         "org_id":1613,         "user_id":2,         "description":"Very good",         "rating":3,         "created_at":null,         "updated_at":null},       {"review_id":4,         "org_id":1613,         "user_id":1,         "description":"Not bad",         "rating":5,         "created_at":null,         "updated_at":null}] }我在审查中有问题,因为它是一个数组。我无法将API中的数据设置为vue中的数据<div v-for="review in reviews" class="box">{{review.review_id}}</div><script>export default {  props: ["id"],  data() {    return {      name_org: "",      picture: "",      headerpic: "",      description: "",      reviews: [],      review: {        review_id: "",        org_id: "",        user_id: "",        description: ""      }    };  },  mounted() {    axios.get("/api/listorgs/" + this.id).then(response => {      var listorg = response.data;      this.name_org = listorg.name_org;      this.picture = listorg.picture;      this.description = listorg.description;      this.headerpic = listorg.headerpic;    });  },};</script>
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 154 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号