(资料图片)
vue router mode 默认为hsas,这样的url中会带有#,如果改成mode:"history"就能去掉#号,也可以正常访问,但是再次率先你页面就会出现404
const router = new Router({mode: "history"});
解决页面刷新404问题
location / { …… try_files $uri $uri/ /index.html;}
location / { if ( !-e $request_filename ) { rewrite ^/(.*) /index.html last; break; }}
参考文档:
https://www.jb51.net/article/261803.htm
X 关闭