它在console.
sandbox.js:1 Fetch API 无法加载 file:///C:/Users/Lizzi/Desktop/novice%20to%20ninja/todos/luigi.json。对于 CORS 请求,URL 方案必须是“http”或“https”
我是aynchronouse编程新手,但我已经阅读了CORS解决方案并尝试了诸如获取 chrome 扩展和禁用 google chrome 的网络安全等方法,但它仍然无法正常工作。
fetch('todos/luigi.json').then((response)=>{
console.log('resolved',response);
}).catch((err)=>{
console.log('rejected', err);
});
Run Code Online (Sandbox Code Playgroud)