在开发版下,没有问题。
在nginx发布版下,出现以下问题:
- 用【http://localhost:8088/】可以打开登录画面、用【http://localhost:8088/AA0001】打不开登录画面。
- 点击菜单栏的menu,不能正常迁移,只显示空白画面。
解决方案:
在nginx的配置文件「nginx.conf」中、追加以下「try_files」的相关设定:
location / {
root web-client;
index index.html index.htm;
try_files $uri $uri/ @router; // 追加内容
}
location @router { // 追加内容
rewrite ^.*$ /index.html last; // 追加内容
} // 追加内容
参考官方文档:
Vue Router和nginx