【发布时间】:2022-01-24 17:24:17
【问题描述】:
在我的 Vue Js 项目中,我有来自 API 的数据,在 JSON 中存储了对象,我无法在我的代码中查看它们。我尝试使用 this.obj =JSON.stringify(this.Flats);,当我使用 console.log 时,我可以看到我所有的数据,但我无法遍历它们以查看 payment 对象
BuildingsService.getAllFlats().then((response) => {
this.Flats = response.data.response;
this.obj =JSON.stringify(this.Flats);
console.log(this.Flats,"dataaa")
});
<div v-for="(object,index) in obj" :key="index"> //didn't work
<span> {{object.flat_number}} </span>
<span > {{object.payment}} </span>
</div>
【问题讨论】:
标签: javascript json vue.js object