123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <template>
- <!-- 移动端菜单 -->
- <div class="mobile-menu">
- <IconMenu
- :openState="mobileMenuShow"
- @click="mobileMenuShow = !mobileMenuShow"
- />
- <Teleport to="body">
- <div
- v-show="mobileMenuShow"
- :class="[
- 'mobile-menu-popover',
- mobileMenuShow ? 'visible' : '',
- ]"
- @click="mobileMenuShow=false"
- >
- <div>
- <RouterLink to="/">首页</RouterLink>
- <RouterLink to="/news">资讯动态</RouterLink>
- <RouterLink to="/introduction">文化概况</RouterLink>
- <RouterLink to="/inheritor">保护传承</RouterLink>
- <RouterLink to="/communicate">传播交流</RouterLink>
- <RouterLink to="/research">理论研究</RouterLink>
- <RouterLink to="/fusion">文旅融合</RouterLink>
- <RouterLink to="/about">关于我们</RouterLink>
- </div>
- </div>
- </Teleport>
- </div>
- <!-- 导航栏 -->
- <nav
- :class="[
- headerBlur ? 'need-blur' : '',
- scrollValue > 200 ? 'nav-scrolled' : 'nav-not-scrolled',
- ]"
- >
- <div></div>
- <div class="group">
- <RouterLink to="/">首页</RouterLink>
- <RouterLink to="/news">资讯动态</RouterLink>
- <RouterLink to="/introduction">文化概况</RouterLink>
- <RouterLink to="/inheritor">保护传承</RouterLink>
- </div>
- <div class="group center">
- <div class="headerlogos">
- <img class="main-clickable" src="@/assets/images/LogoIcon.png" @click="goIndex" />
- <div>
- <p class="large">闽南文化生态保护区<span>(厦门市)</span></p>
- <p>Minnan Cultural Ecological Protection Area</p>
- </div>
- </div>
- </div>
- <div class="group">
- <RouterLink to="/communicate">传播交流</RouterLink>
- <RouterLink to="/research">理论研究</RouterLink>
- <RouterLink to="/fusion">文旅融合</RouterLink>
- <RouterLink to="/about">关于我们</RouterLink>
- </div>
- <div></div>
- </nav>
- </template>
- <script setup lang="ts">
- import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
- import { useRoute, useRouter } from 'vue-router';
- import IconMenu from './icons/IconMenu.vue';
- const router = useRouter();
- const route = useRoute();
- const scrollValue = ref(0);
- const mobileMenuShow = ref(false);
- const headerBlur = computed(() => {
- return route.name != 'home';
- });
- function goIndex() {
- router.push({ name: 'home' });
- }
- function onScroll() {
- scrollValue.value = window.scrollY;
- }
- onMounted(() => {
- window.addEventListener('scroll', onScroll);
- });
- onBeforeUnmount(() => {
- window.removeEventListener('scroll', onScroll);
- });
- </script>
- <style lang="scss">
- @use '@/assets/scss/colors.scss' as *;
- $nav-height: 70px;
- .nav-placeholder {
- height: $nav-height;
- background-color: $primary-color;
- }
- nav {
- position: fixed;
- display: flex;
- justify-content: space-around;
- align-items: center;
- z-index: 100;
- width: 100%;
- height: $nav-height;
- background-color: transparent;
- border-bottom: 1px solid rgba(#fff, 0.2);
- color: #fff;
- transition: all ease-in-out 0.3s;
- &.nav-scrolled {
- background-color: $primary-color;
- }
- &.need-blur.nav-not-scrolled {
- background-color: transparent;
- backdrop-filter: blur(10px);
- }
- a {
- color: rgba(#fff, 0.8);
- text-align: center;
- text-decoration: none;
- &:focus {
- outline: none;
- }
- &.router-link-active, &.router-link-exact-active, &:hover {
- color: #fff;
- }
- &.router-link-exact-active {
- font-weight: bold;
- }
- }
- .group {
- display: flex;
- gap: 1rem;
- a {
- width: 100px;
- height: $nav-height;
- line-height: $nav-height;
- }
- }
- .headerlogos {
- display: flex;
- flex-direction: row;
- align-items: center;
- img {
- width: 45px;
- height: 45px;
- margin-right: 10px;
- }
- > div {
- display: flex;
- flex-direction: column;
- justify-content: center;
- font-family: nzgrRuyinZouZhangKai;
- margin-bottom: 6px;
- p {
- margin: 0;
- font-size: 1rem;
- height: 20px;
- span {
- font-size: 1rem;
- margin-left: 10px;
- }
- &.large {
- height: 33px;
- font-size: 1.8rem;
- letter-spacing: -0.1rem;
- }
- }
- }
- }
- }
- .mobile-menu {
- display: none;
- position: fixed;
- left: 25px;
- top: 20px;
- z-index: 120;
- width: 30px;
- height: 30px;
- color: $text-color-light;
- }
- .mobile-menu-popover {
- position: fixed;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: $box-color;
- border-bottom: $border-grey-color;
- color: $text-color;
- z-index: 101;
- background-color: rgba(#000, 0.1);
- > div {
- display: flex;
- flex-direction: column;
- padding-top: $nav-height;
- height: 100%;
- width: 190px;
- text-align: center;
- background-color: #FBF8F3;
- }
- font-family: SourceHanSerifCNBold;
- animation: mobile-menu-popover-fade 0.3s ease-in-out;
- a {
- line-height: 40px;
- height: 40px;
- width: 100%;
- color: $text-color;
- }
- &.visible {
- display: flex;
- }
- }
- @media (max-width: 1260px) {
- nav {
-
- .group {
- gap: 0.5rem;
- a {
- width: 80px;
- }
- }
- .headerlogos > div {
- display: none;
- }
- }
- }
- @media (max-width: 1024px) {
-
- }
- @media (max-width: 768px) {
- nav {
- justify-content: space-between;
- padding: 0 30px;
- .group:not(.center) {
- display: none;
- }
- .headerlogos > div {
- display: initial;
- }
- }
- .mobile-menu {
- display: block;
- }
- }
- @media (max-width: 550px) {
- nav {
- .headerlogos {
- img {
- width: 35px;
- height: 35px;
- margin-right: 7px;
- }
- > div {
- display: initial;
- margin-bottom: 0;
- p {
- font-size: 0.7rem;
- height: 20px;
- span {
- font-size: 0.7rem;
- margin-left: 10px;
- }
- &.large {
- height: 23px;
- font-size: 1.4rem;
- letter-spacing: -0.1rem;
- }
- }
- }
- }
- }
- }
- @media (max-width: 388px) {
- nav {
- .headerlogos > div {
- display: none;
- }
- }
- }
- @keyframes mobile-menu-popover-fade {
- 0% { opacity: 0; transform: translateX(-100px); }
- 100% { opacity: 1; transform: translateX(0); }
- }
- </style>
|