egg跨域设置

步骤一: # 下载 egg-cors 包 npm i egg-cors --save步骤二: # 在plugin.js中设置开启cors exports.cors = { enable: true, package: 'egg-cors', }; 步骤三: # 在config.{env}.js中配置,注意配置覆盖的问题config.cors = { origin:'*', allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH' };

    推荐阅读