需要访问的路径 http://xxxx.com/manager
vue 需要做的改动:
vue.config.js
let publicPath = '/manager/'
module.exports = {
publicPath: publicPath, // 根据你的实际情况更改这里
lintOnSave: true,
productionSourceMap: false,
}router.js
export const createRouter = () => new VueRouter({
mode: 'history',
base: 'manager',
routes: [...PageRouter, ...ViewsRouter]
})nginx 配置
location /manager {
alias d://ihsp/dist; # 二级目录只能用alias
try_files $uri $uri/ /manager/index.html; # 保障刷新后页面正常
index index.html index.htm;
}版权声明:本文为Amy126原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。