hookehuyr

history模式调整

1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-12 15:01:03 4 + * @LastEditTime: 2024-12-12 15:28:53
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -64,12 +64,12 @@ ...@@ -64,12 +64,12 @@
64 <div :class="[is_active === 'about' ? 'active' : '', 'item']" @click="goTo('/about')">关于海格</div> 64 <div :class="[is_active === 'about' ? 'active' : '', 'item']" @click="goTo('/about')">关于海格</div>
65 <div :class="[is_active === 'contact' ? 'active' : '', 'item']" @click="goTo('/contact')">联系我们</div> 65 <div :class="[is_active === 'contact' ? 'active' : '', 'item']" @click="goTo('/contact')">联系我们</div>
66 <div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div> --> 66 <div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div> -->
67 - <a :class="[is_active === 'solution' ? 'active' : '', 'item']" :href="`${baseUrl}#/solution/index`" @click="goTo('/solution/index')">解决方案</a> 67 + <a :class="[is_active === 'solution' ? 'active' : '', 'item']" :href="`${baseUrl}/solution/index`" @click.prevent="goTo('/solution/index')">解决方案</a>
68 - <a :class="[is_active === 'news' ? 'active' : '', 'item']" :href="`${baseUrl}#/news`" @click="goTo('/news')">新闻中心</a> 68 + <a :class="[is_active === 'news' ? 'active' : '', 'item']" :href="`${baseUrl}/news`" @click.prevent="goTo('/news')">新闻中心</a>
69 - <a :class="[is_active === 'recruit' ? 'active' : '', 'item']" :href="`${baseUrl}#/recruit`" @click="goTo('/recruit')">招聘信息</a> 69 + <a :class="[is_active === 'recruit' ? 'active' : '', 'item']" :href="`${baseUrl}/recruit`" @click.prevent="goTo('/recruit')">招聘信息</a>
70 - <a :class="[is_active === 'about' ? 'active' : '', 'item']" :href="`${baseUrl}#/about`" @click="goTo('/about')">关于海格</a> 70 + <a :class="[is_active === 'about' ? 'active' : '', 'item']" :href="`${baseUrl}/about`" @click.prevent="goTo('/about')">关于海格</a>
71 - <a :class="[is_active === 'contact' ? 'active' : '', 'item']" :href="`${baseUrl}#/contact`" @click="goTo('/contact')">联系我们</a> 71 + <a :class="[is_active === 'contact' ? 'active' : '', 'item']" :href="`${baseUrl}/contact`" @click.prevent="goTo('/contact')">联系我们</a>
72 - <a :class="[is_active === 'index' ? 'active' : '', 'item']" :href="`${baseUrl}#/`" @click="goTo('/')">首页</a> 72 + <a :class="[is_active === 'index' ? 'active' : '', 'item']" :href="`${baseUrl}/`" @click.prevent="goTo('/')">首页</a>
73 </div> 73 </div>
74 </el-col> 74 </el-col>
75 </el-row> 75 </el-row>
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
210 }, 210 },
211 computed: { 211 computed: {
212 baseUrl () { 212 baseUrl () {
213 - return location.origin + location.pathname; 213 + return location.origin;
214 } 214 }
215 }, 215 },
216 async mounted () { 216 async mounted () {
......
...@@ -12,8 +12,9 @@ import ConfigRouter from './route.js' ...@@ -12,8 +12,9 @@ import ConfigRouter from './route.js'
12 Vue.use(VueRouter) 12 Vue.use(VueRouter)
13 13
14 const router = new VueRouter({ 14 const router = new VueRouter({
15 - history: false, 15 + // history: false,
16 - hashbang: true, 16 + // hashbang: true,
17 + mode: 'history',
17 base: '/', 18 base: '/',
18 routes: ConfigRouter, 19 routes: ConfigRouter,
19 scrollBehavior(to, from, savedPosition) { 20 scrollBehavior(to, from, savedPosition) {
......