文件操作 - TheHeader.vue
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/components/TheHeader.vue
编辑文件内容
<script setup lang="ts"> const localePath = useLocalePath(); const switchLocalePath = useSwitchLocalePath(); const isFixed = ref(false); const fixedHeader = () => { if (window.scrollY > 0) { isFixed.value = true; } else { isFixed.value = false; } }; onMounted(() => { fixedHeader(); window.addEventListener('scroll', fixedHeader); window.addEventListener('resize', fixedHeader); }); onUnmounted(() => { window.removeEventListener('scroll', fixedHeader); window.removeEventListener('resize', fixedHeader); }); </script> <template> <header class="header" :class="{ fixed: isFixed }" > <div class="container"> <NuxtLink :to="localePath('index')" class="logo" :aria-label="$t('header.home')" > <img src="/img/logo.png" srcset="/img/logo@2x.png 2x" alt="" /> </NuxtLink> <div class="lang-switcher"> <AppIcon name="global"></AppIcon> <NuxtLink class="lang-link link" :to="switchLocalePath('en')" > En </NuxtLink> </div> <AppButton class="btn-small header-btn">{{ $t('header.signIn') }}</AppButton> </div> </header> </template> <style lang="less" scoped> .header { position: fixed; inset: 0 0 auto; z-index: 666; background: @white; &:after { content: ''; position: absolute; inset: 100% 0 auto; border-top: solid 1px @border; transition: opacity 0.4s; pointer-events: none; opacity: 0; will-change: opacity; } .container { display: flex; justify-content: space-between; align-items: center; height: var(--header-height); gap: 10px; @media @md_ { gap: 24px; } } &.fixed { &:after { opacity: 1; } } } .logo { display: flex; max-width: 244px; margin-right: auto; @media @md { max-width: 170px; } } .lang-switcher { display: flex; gap: 8px; align-items: center; color: @title; @media @md { gap: 6px; font-size: 15px; .icon { --size: 20px; } } } .lang-link { &.router-link-active { color: inherit; } } .header-btn { padding: 0 30px; @media @md { padding: 0 22px; } } </style>
修改文件时间
将文件时间修改为当前时间的前一年
删除文件