在使用npm run build将项目打包完成之后会发现使用ProxyTable失效,因为该代理跨域的方法只能在本地开发生效
解决办法
1.将proxy对应的内容注释掉
2.将项目部署在nginx服务器中
nginx配置
1.在nginx的配置文件中(nginx.conf)
```location /api/ {proxy_pass http://weide-/;}```
注意地址的映射,我是将打包之后的文件放在了/home/ninesun/soft/tomcat/webapps/weide目录下,所以配置的映射如上图所示
重启nginx服务即可
service nginx restart