router/index.js配置
#vue2配置如下
const router = new VueRouter({
mode: 'history'
...
});
#vue3配置如下
const router = createRouter({
history: createWebHistory(),#history模式
...
});
vue.config.js配置
module.exports = {
#publicPath: './',改为'/'
publicPath: '/',
...
}
nginx配置
server {
location / {
try_files $uri $uri/ /index.html = 404;
...
}
}