vue router mode 默认为hsas, 这样的url中带有#,让有强迫症的人很不爽,可以修改
const router = new Router({
mode: 'history'
});
mode: 'history'就能去掉#号,不过这样也导致一个问题,就是想服务器上因为没有# 直接去找资源文件,肯定是没有的
要嘛去配置服务器
nginx,修改nginx.conf
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
nginx -s reload,重启加载配置。就可以了。
要嘛就老老实实的加载哈希值
原文:https://blog.csdn.net/qq_37942845/article/details/81103129