hookehuyr

修改导航栏为a标签跳转

<!--
* @Date: 2024-09-26 13:42:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-10 16:12:19
* @LastEditTime: 2024-12-11 10:11:23
* @FilePath: /hager/src/components/common/hagerHeader.vue
* @Description: 文件描述
-->
......@@ -57,12 +57,18 @@
<el-image style="width: auto; height: 0.65rem" src="https://cdn.ipadbiz.cn/hager/icon/%E8%8F%9C%E5%8D%95@2x.png" fit="fit"></el-image>&nbsp;
<span @mouseenter="onClickProduct">产品中心</span>
</div>
<div :class="[is_active === 'solution' ? 'active' : '', 'item']" @click="goTo('/solution/index')">解决方案</div>
<!-- <div :class="[is_active === 'solution' ? 'active' : '', 'item']" @click="goTo('/solution/index')">解决方案</div>
<div :class="[is_active === 'news' ? 'active' : '', 'item']" @click="goTo('/news')">新闻中心</div>
<div :class="[is_active === 'recruit' ? 'active' : '', 'item']" @click="goTo('/recruit')">招聘信息</div>
<div :class="[is_active === 'about' ? 'active' : '', 'item']" @click="goTo('/about')">关于海格</div>
<div :class="[is_active === 'contact' ? 'active' : '', 'item']" @click="goTo('/contact')">联系我们</div>
<div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div>
<div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div> -->
<a :class="[is_active === 'solution' ? 'active' : '', 'item']" :href="`${baseUrl}#/solution/index`" @click="goTo('/solution/index')">解决方案</a>
<a :class="[is_active === 'news' ? 'active' : '', 'item']" :href="`${baseUrl}#/news`" @click="goTo('/news')">新闻中心</a>
<a :class="[is_active === 'recruit' ? 'active' : '', 'item']" :href="`${baseUrl}#/recruit`" @click="goTo('/recruit')">招聘信息</a>
<a :class="[is_active === 'about' ? 'active' : '', 'item']" :href="`${baseUrl}#/about`" @click="goTo('/about')">关于海格</a>
<a :class="[is_active === 'contact' ? 'active' : '', 'item']" :href="`${baseUrl}#/contact`" @click="goTo('/contact')">联系我们</a>
<a :class="[is_active === 'index' ? 'active' : '', 'item']" :href="`${baseUrl}#/`" @click="goTo('/')">首页</a>
</div>
</el-col>
</el-row>
......@@ -201,6 +207,11 @@ export default {
this.$emit('onShowMenu', val)
}
},
computed: {
baseUrl () {
return location.origin + location.pathname;
}
},
async mounted () {
const { code, data } = await getProductMenuAPI();
if (code) {
......@@ -351,11 +362,11 @@ export default {
this.show = false;
},
goTo (path) { // 跳转页面
if (this.$route.path !== path) { // 不能重复点击当前页面
this.$router.push({
path,
});
}
// if (this.$route.path !== path) { // 不能重复点击当前页面
// this.$router.push({
// path,
// });
// }
if (path.indexOf('/solution') === -1) { // 不统计解决方案页面
// TAG: 统计埋点
this.maEvent(`h5_${path.slice(1)}`);
......@@ -568,6 +579,7 @@ export default {
// justify-content: space-around;
margin-top: 1.25rem;
.item {
text-decoration: none;
color: @secondary-color;
margin-right: 1.5rem;
font-size: 0.95rem;
......