我有來(lái)自API的數(shù)據(jù),但無(wú)法將數(shù)組中的數(shù)據(jù)設(shè)置為vue.js中的this.data這是來(lái)自API的data(JSON)你能告訴我這個(gè)語(yǔ)法嗎{"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}] }我在審查中有問(wèn)題,因?yàn)樗且粋€(gè)數(shù)組。我無(wú)法將API中的數(shù)據(jù)設(shè)置為vue中的數(shù)據(jù)<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>
Vue + Laravel:如果元組數(shù)據(jù)之一中的表單數(shù)組中的數(shù)據(jù),如何從api掛載數(shù)據(jù)
守著星空守著你
2021-03-29 17:15:40