You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
3.8 KiB
213 lines
3.8 KiB
<template> |
|
<div :class="!flog ? 'tabbar' : 'tabbar-active'"> |
|
<div class="container"> |
|
<div class="left"> |
|
<div class="logo-box"> |
|
<div class="lesson">LGOG</div> |
|
</div> |
|
|
|
<div class="menu"> |
|
<ul> |
|
<li v-for="(item, index) in constRouter.children" :key="index"> |
|
{{ item.meta.title }} |
|
</li> |
|
</ul> |
|
</div> |
|
</div> |
|
<div class="right"> |
|
<div class="registered gradient">注册</div> |
|
<div class="login">登录</div> |
|
</div> |
|
</div> |
|
</div> |
|
</template> |
|
|
|
<script lang="ts" setup> |
|
import { constRouter } from '@/router/module/constRouter' |
|
// import { useRouter, useRoute } from 'vue-router' |
|
import { onMounted, ref } from 'vue' |
|
// const $router = useRouter() |
|
// const $route = useRoute() |
|
console.log(constRouter, '111') |
|
|
|
const flog = ref(false) |
|
onMounted(() => { |
|
window.addEventListener('scroll', () => { |
|
if (window.scrollY >= 50) { |
|
flog.value = true |
|
} else if (flog.value && window.scrollY <= 50) { |
|
flog.value = false |
|
} |
|
}) |
|
}) |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.logo-box { |
|
display: flex; |
|
align-items: center; |
|
column-gap: 20px; |
|
.logo { |
|
width: 50px; |
|
|
|
img { |
|
width: 100%; |
|
height: 100%; |
|
} |
|
} |
|
|
|
.lesson { |
|
font-size: 30px; |
|
font-weight: bolder; |
|
color: #1d2129; |
|
} |
|
} |
|
|
|
.tabbar { |
|
position: fixed; |
|
top: 0; |
|
z-index: 1; |
|
height: 80px; |
|
width: 100%; |
|
background-color: transparent; |
|
animation-duration: 0.3s; |
|
animation-name: tabber-to; |
|
} |
|
|
|
.tabbar-active { |
|
position: fixed; |
|
top: 0; |
|
height: 80px; |
|
width: 100%; |
|
background-color: #fff; |
|
animation-duration: 0.3s; |
|
animation-name: tabber; |
|
z-index: 999; |
|
box-shadow: 0px 0px 43px rgba(0, 0, 0, 0.2); |
|
} |
|
|
|
@keyframes tabber { |
|
0% { |
|
// transform: translateY(-80px); |
|
background-color: transparent; |
|
} |
|
|
|
100% { |
|
// transform: translateY(0); |
|
background-color: #fff; |
|
} |
|
} |
|
|
|
@keyframes tabber-to { |
|
0% { |
|
// transform: translateY(-80px); |
|
background-color: #fff; |
|
} |
|
|
|
100% { |
|
// transform: translateY(0); |
|
background-color: transparent; |
|
} |
|
} |
|
|
|
.container { |
|
height: 100%; |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-between; |
|
margin: 0 auto; |
|
width: $base-container-width; |
|
.left { |
|
display: flex; |
|
align-items: center; |
|
} |
|
.right { |
|
display: flex; |
|
div { |
|
width: 108px; |
|
height: 40px; |
|
text-align: center; |
|
line-height: 40px; |
|
border-radius: 5px; |
|
font-size: 14px; |
|
cursor: pointer; |
|
} |
|
.registered{ |
|
color: #fff; |
|
} |
|
.login{ |
|
color: #1D2129; |
|
margin-left: 20px; |
|
border: 1px solid #E5E6EB; |
|
} |
|
} |
|
.menu { |
|
position: relative; |
|
padding: 0 20px; |
|
height: 100%; |
|
display: flex; |
|
align-items: center; |
|
|
|
ul { |
|
display: flex; |
|
align-items: center; |
|
|
|
li { |
|
padding: 12px 20px; |
|
color: #1d2129; |
|
font-size: 14px; |
|
cursor: pointer; |
|
transition: all 0.2s; |
|
position: relative; |
|
} |
|
|
|
li:hover { |
|
color: #0033f7; |
|
transform: translateY(-5px); |
|
} |
|
|
|
.active::before { |
|
content: ' '; |
|
display: block; |
|
position: absolute; |
|
top: 0px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
width: 5px; |
|
height: 5px; |
|
border-radius: 50%; |
|
background-color: #fff; |
|
} |
|
} |
|
|
|
.entry { |
|
position: absolute; |
|
top: 5px; |
|
right: 30px; |
|
display: flex; |
|
align-content: center; |
|
|
|
div { |
|
// padding: 5px; |
|
margin: 5px; |
|
margin-right: 0; |
|
padding: 0 10px; |
|
border-right: 1px solid #fff; |
|
color: #fff; |
|
font-size: 14px; |
|
cursor: pointer; |
|
} |
|
|
|
div:last-child { |
|
border-right: none; |
|
} |
|
} |
|
} |
|
|
|
.logo { |
|
// height: 100%; |
|
display: flex; |
|
align-items: center; |
|
} |
|
} |
|
</style>
|
|
|