vue承诺错误,我有错误的错误
虽然同样的方法可以与另一个API调用相同,但此API的获取使我有希望。错误读取 未识别(在承诺中)typeError:无法读取未定义的属性(读取'json')
我的获取代码如下:
import { ref } from "vue";
export default {
async setup() {
const prompProducts = ref(null);
const bc_prompProducts = await fetch(
"https://booking.hemantbhutanrealestate.com/api/v1/get_frontend_products"
);
prompProducts.value = await bc_prompProducts.json();
return {
prompProducts,
};
},
};
虽然同样的方法在我的其他API调用上无错误地工作,但在此遇到错误一。请帮助,该网站已经在生产中!
While the same method works just fine with another api call, fetch from this api is getting me error on promise. the error readsUncaught (in promise) TypeError: Cannot read properties of undefined (reading 'json')
My fetch code reads as below:
import { ref } from "vue";
export default {
async setup() {
const prompProducts = ref(null);
const bc_prompProducts = await fetch(
"https://booking.hemantbhutanrealestate.com/api/v1/get_frontend_products"
);
prompProducts.value = await bc_prompProducts.json();
return {
prompProducts,
};
},
};
While this same method works without error on my other api calls, am getting error on this one. Please help, the site is on production already!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将async调用置于函数中并调用,也可以使用
on mounted
钩子:You can put your async call in function and call it, or you can use
onMounted
hook: