perf: 优化导航栏在不同设备的交互表现

This commit is contained in:
pengzhanbo 2024-02-18 01:23:14 +08:00
parent d6c9fba835
commit 16c65daea9
6 changed files with 31 additions and 19 deletions

View File

@ -49,6 +49,6 @@
"VuePress",
"vuepress plugin",
"content-update",
"vuepress-plugin-plugin-content-update"
"vuepress-plugin-content-update"
]
}

View File

@ -41,6 +41,7 @@ const classes = computed(() => {
'local-nav': true,
'fixed': empty.value,
'reached-top': y.value >= navHeight.value,
'is-blog': page.value.isBlogPost,
}
})
@ -98,6 +99,23 @@ const showLocalNav = computed(() => {
}
@media (min-width: 960px) {
.local-nav.is-blog {
display: none;
}
.local-nav {
top: var(--vp-nav-height);
width: calc(100% - var(--vp-sidebar-width));
margin-left: var(--vp-sidebar-width);
border-top: none;
}
.local-nav .menu {
visibility: hidden;
}
}
@media (min-width: 1280px) {
.local-nav {
display: none;
}

View File

@ -33,7 +33,7 @@ const hasExtraContent = computed(
<div v-if="theme.appearance" class="group">
<div class="item appearance">
<p class="label">
Appearance
{{ theme.appearanceText || 'Appearance' }}
</p>
<div class="appearance-action">
<SwitchAppearance />

View File

@ -33,7 +33,6 @@ onContentUpdated(() => zoom?.refresh())
>
<div class="container">
<div v-if="hasAside" class="aside">
<div class="aside-curtain" />
<div class="aside-container">
<div class="aside-content">
<PageAside />
@ -101,15 +100,6 @@ onContentUpdated(() => zoom?.refresh())
display: none;
}
/* .aside-curtain {
position: fixed;
bottom: 0;
z-index: 10;
width: 224px;
height: 32px;
background: linear-gradient(transparent, var(--vp-c-bg) 70%);
} */
.aside-content {
display: flex;
flex-direction: column;
@ -150,6 +140,15 @@ onContentUpdated(() => zoom?.refresh())
padding: 32px 32px 0;
}
.plume-page .container {
display: flex;
justify-content: center;
}
.plume-page.is-blog .aside {
display: block;
}
.plume-page:not(.has-sidebar) .container {
display: flex;
justify-content: center;
@ -162,11 +161,6 @@ onContentUpdated(() => zoom?.refresh())
}
@media (min-width: 1280px) {
.plume-page .container {
display: flex;
justify-content: center;
}
.plume-page .aside {
display: block;
}

View File

@ -164,7 +164,7 @@
/* plugin-search */
.navbar-search .search-box input {
padding: 0 0.4rem 0 1.555rem;
padding: 0 0.3rem 0 1.655rem;
background-position: 0.5rem 0.4rem;
}

View File

@ -588,7 +588,7 @@ html[lang="zh-CN"] {
--search-item-focus-bg-color: var(--vp-c-bg-alt);
--search-input-width: 8rem;
--search-result-width: 20rem;
--search-border-color: var(--vp-c-divider);
--search-border-color: transparent;
--search-accent-color: var(--vp-c-brand-1);
}