【发布时间】:2021-01-08 23:49:57
【问题描述】:
我正在使用 vue-2。并且想通过获取 API 对 firebase 实时数据库进行浅层查询。但是在开发服务器上运行时,它显示 CORS 被阻止。我该怎么办? PS:我也在用vuefire
created(){
var apiUrl = 'https://console.firebase.google.com/u/4/project/enajori-45094/database/enajori-45094/data/Admin/Data%20Collection/Paying%20Guest';
fetch(apiUrl).then(response => {
return response.json();
}).then(data => {
console.log(data);
}).catch(err => {
console.log(err);
});
}
【问题讨论】:
-
在 Stack Overflow 上,不要显示代码和文本的图片。将文本复制到问题中并设置格式,以便于阅读、复制和搜索。
标签: javascript api vue.js firebase-realtime-database cors