参考Vue-router官方文档给出的解决方案: nginx解决方式
在nginx配置文件添加这句即可 当找不到资源路径时(404)会自动跳转到index.html

1
2
3
location / {
try_files $uri $uri/ /index.html;
}

image.png