pref: rebuild top bar

This commit is contained in:
KUN1007 2023-10-21 16:34:16 +08:00
parent c24f8410ed
commit 2aedb618d3
3 changed files with 92 additions and 88 deletions

View file

@ -59,28 +59,31 @@ onBeforeRouteLeave(() => {
</KeepAlive> </KeepAlive>
</transition> </transition>
</div> </div>
<!-- 网站的名字和网站图标 -->
<div class="kungalgame"> <div class="kungalgame">
<!-- 网站的名字和网站图标 -->
<RouterLink to="/kun">
<img src="@/assets/images/favicon.webp" alt="KUNgal" />
</RouterLink>
<RouterLink to="/kun"> <RouterLink to="/kun">
<img
src="@/assets/images/favicon.webp"
alt="KUN Visual Novel 鲲 Galgame"
/>
<span>{{ $tm('header.name') }}</span> <span>{{ $tm('header.name') }}</span>
</RouterLink> </RouterLink>
</div> </div>
<!-- 导航栏 -->
<div class="top-bar"> <div class="top-bar">
<ul> <!-- 顶部单个板块 -->
<!-- 顶部单个板块 --> <span v-for="kun in topBarItem" :key="kun.index">
<li v-for="kun in topBarItem" :key="kun.index"> <RouterLink :to="{ path: kun.router }">
<RouterLink :to="{ path: kun.router }"> {{ $tm(`header['${kun.name}']`) }}
{{ $tm(`header['${kun.name}']`) }} </RouterLink>
</RouterLink> </span>
</li> <!-- 顶部板块下部的 hover 效果 -->
<!-- 顶部板块下部的 hover 效果 --> <div class="box"></div>
<div class="box"></div>
</ul>
</div> </div>
</div> </div>
<div class="kungalgamer-info"> <div class="kungalgamer-info">
<!-- showKUNGalgamePanel store 里的布尔值,其真假控制设置面板的显示与关闭 --> <!-- showKUNGalgamePanel store 里的布尔值,其真假控制设置面板的显示与关闭 -->
<span @click="showKUNGalgamePanel = !showKUNGalgamePanel"> <span @click="showKUNGalgamePanel = !showKUNGalgamePanel">
@ -122,13 +125,10 @@ onBeforeRouteLeave(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
/* 头部样式 */ /* 头部样式 */
.header { .header {
/* 头部高度 */
height: 58px; height: 58px;
/* 头部下方阴影 */
box-shadow: 0 2px 4px 0 var(--kungalgame-trans-blue-1); box-shadow: 0 2px 4px 0 var(--kungalgame-trans-blue-1);
/* 头部背景 */
backdrop-filter: blur(5px);
background-color: var(--kungalgame-trans-white-5); background-color: var(--kungalgame-trans-white-5);
backdrop-filter: blur(5px);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@ -151,22 +151,7 @@ onBeforeRouteLeave(() => {
.nav-top { .nav-top {
display: flex; display: flex;
align-items: center; align-items: center;
} height: 100%;
.kungalgame {
display: flex;
align-items: center;
img {
height: 50px;
margin-left: 50px;
cursor: pointer;
}
span {
margin-left: 20px;
margin-right: 7px;
color: var(--kungalgame-font-color-3);
font-weight: bold;
cursor: pointer;
}
} }
// //
@ -176,61 +161,77 @@ $navNumber: v-bind(navItemNum);
position: relative; position: relative;
text-align: center; text-align: center;
width: v-bind(navItemLength); width: v-bind(navItemLength);
ul { align-items: center;
align-items: center; display: flex;
.box {
border-radius: 2px;
bottom: 0;
height: 7px;
left: 0;
position: absolute;
transition: 0.5s;
width: calc(100% / $navNumber);
&:hover {
z-index: -1;
}
}
a {
display: block;
color: var(--kungalgame-blue-5);
width: 100%;
height: 100%;
}
span {
cursor: pointer;
display: block;
font-weight: bold;
line-height: 58px;
width: 100%;
&:nth-child(1):hover ~ .box {
background-color: var(--kungalgame-red-3);
left: calc(100% / $navNumber * 0);
}
&:nth-child(2):hover ~ .box {
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 1);
}
&:nth-child(3):hover ~ .box {
background-color: var(--kungalgame-yellow-2);
left: calc(100% / $navNumber * 2);
}
&:nth-child(4):hover ~ .box {
filter: hue-rotate(240deg);
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 3);
}
&:nth-child(5):hover ~ .box {
filter: hue-rotate(60deg);
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 4);
}
}
}
.kungalgame {
display: flex;
align-items: center;
margin-left: 50px;
a {
display: flex; display: flex;
right: 5%; align-items: center;
.box { color: var(--kungalgame-font-color-3);
border-radius: 2px;
bottom: 0;
height: 7px;
left: 0;
position: absolute;
transition: 0.5s;
width: calc(100% / $navNumber);
&:hover { img {
z-index: -1; width: 50px;
} height: 50px;
} margin-right: 30px;
a {
// a
display: block;
color: var(--kungalgame-blue-5);
width: 100%;
height: 100%;
}
li {
cursor: pointer;
display: block;
font-weight: bold;
line-height: 58px;
width: 100%;
&:nth-child(1):hover ~ .box {
background-color: var(--kungalgame-red-3);
left: calc(100% / $navNumber * 0);
}
&:nth-child(2):hover ~ .box {
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 1);
}
&:nth-child(3):hover ~ .box {
background-color: var(--kungalgame-yellow-2);
left: calc(100% / $navNumber * 2);
}
&:nth-child(4):hover ~ .box {
filter: hue-rotate(240deg);
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 3);
}
&:nth-child(5):hover ~ .box {
filter: hue-rotate(60deg);
background-color: var(--kungalgame-blue-3);
left: calc(100% / $navNumber * 4);
}
} }
} }
} }

View file

@ -59,6 +59,8 @@ const user = computed(() => props.user)
flex-grow: 1; flex-grow: 1;
} }
img { img {
height: 50px;
width: 50px;
padding: 2px; padding: 2px;
border-radius: 50%; border-radius: 50%;
/* 页面缩小时头像缩小 */ /* 页面缩小时头像缩小 */

View file

@ -49,11 +49,12 @@ const user = computed(() => props.user)
} }
/* 头像 */ /* 头像 */
.avatar { .avatar {
/* 图像加载不出来时页面不塌陷 */
width: 100px; width: 100px;
margin-top: 17px; margin-top: 17px;
img { img {
width: 100px; width: 100px;
height: 100px;
} }
} }
/* 名字 */ /* 名字 */