栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Nginx+Vue实现二级子目录history和hash两种模式访问

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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.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/',

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/334047.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号