nginx中配置
location / {
root '项目路径/';
try_files $uri $uri/ /index.html; //关键部分
index index.html index.htm;
}
vue router配置
//配置错误页面
{
path: '*',
name: "All",
component: () => import('@/views/Error')
}
const router = new VueRouter({
routes,
mode: 'history', // 此处改为history
base: '/'
})