【发布时间】:2018-11-08 12:20:15
【问题描述】:
我正在尝试从本地读取 json 文件,但作为响应,我收到了如下所示的错误
Fetch API cannot load file:///var/www/desktop-electron//dashboard/bnb.json. URL scheme "file" is not supported
这是我的代码
fetch(`${drr}/dashboard/bnb.json`)
.then(res => res.json())
.then(res => {
this.currency = res;
Object.assign(this.stock, res.pairs[0]);
Object.assign(this.header, res.pairs[0]);
this.header.name = res.name;
}).catch(function(e) { console.log(e) });
我已经阅读了谷歌的所有解决方案,但无法解决问题!
【问题讨论】: