2020-04-28 09:36
运行起来了,但是前台只有一个首页,其他页面都打不开
Error: Cannot find module '@/views/cm/org'
at webpackEmptyContext (eval at ./src/store/modules sync recursive (app.js:3805), :2:10)
at eval (webpack-internal:///./src/store/modules/permission.js:77)
类似这样的报错
@一川死水
2020-04-27 15:36
我也遇到了同样的问题,我的解决代码如下:
//允许跨域访问的域名,若有端口需要写全(协议+域名+端口),若没有端口末尾不用加'/'
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE,OPTIONS");
//允许前端带认证Cookie,启用此项后,上面的域名不能为*,必须制定具体的域名,否则浏览器会提示
response.setHeader("Access-Control-Allow-Credentials","true");
//提示OPTION预检时,后端需要设置的两个常用自定义头
response.setHeader("Access-Control-Allow-Headers","Content-Type,X-Requested-With,withCredentials");
2020-04-27 15:34
上面的代码虽然可以跨域了,但是cookie信息会丢失的。如果想要cookie必须如下的写法:
//允许跨域访问的域名,若有端口需要写全(协议+域名+端口),若没有端口末尾不用加'/'
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE,OPTIONS");
//允许前端带认证Cookie,启用此项后,上面的域名不能为*,必须制定具体的域名,否则浏览器会提示
response.setHeader("Access-Control-Allow-Credentials","true");
//提示OPTION预检时,后端需要设置的两个常用自定义头
response.setHeader("Access-Control-Allow-Headers","Content-Type,X-Requested-With,withCredentials");