zhongshujie
2025-08-08 401ed176c9f1bdd97ccdf827d9454b11a3891f79
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<template>
  <div class="navPage">
    <div class="navBox">
        <ul class="navList flex ai-c jc-sb">
          <li v-for="item in navList" :key="item.path"
            :class="{ active: route.query.type ? `/${route.query.type}` == item.path : route.path.indexOf(item.path) > -1 }"
            @click="goPage(item.path)">
            <img :src="route.path.indexOf(item.path) ? item.activeIcon : item.defaultIcon">
            <span>{{ item.name }}</span>
          </li>
        </ul>
    </div>
  </div>
 
</template>
 
<script lang="ts" setup>
import contrast from '@/assets/images/header/contrast_icon.svg'
import activeContrast from '@/assets/images/header/active_contrast_icon.svg'
import annotate from '@/assets/images/header/annotate_icon.svg'
import activeAnnotate from '@/assets/images/header/active_annotate_icon.svg'
import us from '@/assets/images/header/us_icon.svg'
import activeUs from '@/assets/images/header/active_us_icon.svg'
import { useRoute, useRouter } from 'vue-router'
import { ref, inject} from 'vue'
const router = useRouter()
const route = useRoute()
const config:any = inject('config')
const navList = ref([
  {
    name: '对读模式',
    path: config.pathData.comparison,
    defaultIcon:contrast,
    activeIcon:activeContrast
  },
  {
    name: '注释模式',
    path: config.pathData.annotation,
    defaultIcon:annotate,
    activeIcon:activeAnnotate
  },
  {
    name: '关于我们',
    path:  config.pathData.about,
    defaultIcon:us,
    activeIcon:activeUs
  },
])
const goPage = (path: string) => {
  router.push(path)
}
</script>
 
<style lang="less" scoped>
.navPage{
  height: 76px;
  .navBox {
    width: 600px;
    height: 100%;
    margin: 0 auto;
  
    .navList {
      height: 76px;
      li {
        display: flex;
        align-items: center;
        height: 76px;
        line-height: 76px;
        color: @default-banner-txt-color;
        width: 150px;
        font-size: 18px;
        font-weight: bold;
        text-align: center;
        cursor: pointer;
        span {
          margin-left: 7px;
        }
      }
    }
  
    .active {
      color: @active-txt-color !important;
      background-size: 150px;
    }
  }
}
</style>