Nginx+Vue实现二级子目录history和hash两种模式访问
运行环境:Nginx , Vue二级目录名称为 ipv6-manage访问方式为: https://www.aaaapppp.com/ipv6-manage/Nginx配置location /ipv6-manage {try_files $uri $uri/ /ipv6-manage/index.html;}Vue配置:src/router/index.jsexport default new R
·
运行环境:Nginx , Vue
二级目录名称为 ipv6-manage
访问方式为: https://www.aaaapppp.com/ipv6-manage/
Nginx配置
location /ipv6-manage {
try_files $uri $uri/ /ipv6-manage/index.html;
}
Vue配置:
src/router/index.js
export default new Router({
//若将这里注释掉,则默认为hash模式,URL里面带着#号 如/ipv6-manage/#isystem/setup
//否则为history模式,网址里面带着实际路径 如/ipv6-manage/isystem/setup
mode: 'history',
base: '/ipv6-manage/',
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
})
vue.config.js
publicPath:'/ipv6-manage/',
更多推荐
已为社区贡献1条内容
所有评论(0)