From 4deda573bfc6663c1793b29f60a6e1035d891520 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 23 八月 2019 16:36:42 +0800 Subject: [PATCH] news --- src/components/header.vue | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/components/header.vue b/src/components/header.vue index e2c2f9f..910e5a0 100644 --- a/src/components/header.vue +++ b/src/components/header.vue @@ -9,7 +9,7 @@ <span class="navico" v-else @click="showNav"><img src="../img/close.png" alt=""></span> <!-- pc绔彍鍗曞垪琛� --> <ul class="nav_ul" ref="nav_ul"> - <li v-for="(menu, index) in menus" :key="index" :class="{active1: cur === index}" @click="jump(menu.url)"> + <li v-for="(menu, index) in menus" :key="index" :class="{' menu-active': curtab === index, ' menu-hover': cur === index}" @click="jump(menu.url)"> <span @mouseover="contrlSubmenu(index)">{{ menu.text }}</span> </li> <div class="list1 active" v-if="menus[1].flag"> @@ -79,8 +79,8 @@ name: 'Header', data() { return { - activeNames: ['1'], - cur: 0, + cur: -1, + curtab: 0, isShow: false, selectedsubId: null, menus: [{ @@ -138,6 +138,14 @@ this.isShow = false name = name.toLowerCase() if (!type) { // 涓婚〉闈㈣烦杞� + let change = { + index: 0, + successcase: 2, + partner: 3, + news: 4, + companyprofile: 5 + } + this.curtab = change[name] if (name === 'companyprofile') { // 鍏充簬鏄庣,閿氱偣鍙傛暟 this.$router.push({name: name, params: {hash: 'null'}}) } else { @@ -146,15 +154,18 @@ } else if (type === 'submenu') { // 浜у搧涓績瀛愰〉闈㈣烦杞� this.menus[1].flag = false this.menus[5].flag = false + this.curtab = 1 this.selectedsubId = index this.$router.push({name: name, params: {menuId: index}}) } else if (type === 'aboutUs') { // 鍏充簬鏄庣瀛愰〉闈㈣烦杞� + this.curtab = 5 if (index === 3) { // 鍔犲叆鏄庣 this.$router.push({name: name}) } else { this.$router.push({name: 'companyprofile', params: {hash: `#anchor-${index + 1}`}}) } } + }, showNav () { this.isShow = !this.isShow @@ -174,6 +185,7 @@ } }, leave () { + this.cur = -1 this.menus[1].flag = false this.menus[5].flag = false }, @@ -235,7 +247,7 @@ -webkit-animation: gupIn 1s 0.1s both; -moz-animation: gupIn 1s 0.1s both; animation: gupIn 1s 0.1s both; - z-index: 8888; + z-index: 2000; top: 0; .wrapper { @@ -542,7 +554,10 @@ .active { opacity: 1; } - .active1 { + .menu-hover { + background: #232323; + } + .menu-active { background: #212020; } </style> -- Gitblit v1.8.0