mirror of https://github.com/YunYouJun/valaxy
feat(nav): add showItems control
This commit is contained in:
parent
0c20ee307a
commit
d802b0a3fc
|
@ -11,6 +11,7 @@ const siteConfig = useSiteConfig()
|
|||
const themeConfig = useThemeConfig()
|
||||
|
||||
const showMenu = ref(false)
|
||||
const showItems = themeConfig.value.showItems || false
|
||||
const route = useRoute()
|
||||
onMounted(() => {
|
||||
if (route.meta.layout === 'home') {
|
||||
|
@ -63,13 +64,31 @@ const app = useAppStore()
|
|||
title="博客文章"
|
||||
/>
|
||||
|
||||
<YunNavMenuItem
|
||||
v-for="item, i in themeConfig.pages"
|
||||
:key="i"
|
||||
:icon="item.icon"
|
||||
:to="item.url"
|
||||
:title="item.name"
|
||||
/>
|
||||
<!-- Default items are displayed when `showItems` is false -->
|
||||
<div v-if="!showItems">
|
||||
<YunNavMenuItem
|
||||
icon="i-ri-archive-line" to="/archives/"
|
||||
title="归档"
|
||||
/>
|
||||
<YunNavMenuItem
|
||||
icon="i-ri-folder-2-line" to="/categories/"
|
||||
title="分类"
|
||||
/>
|
||||
<YunNavMenuItem
|
||||
icon="i-ri-price-tag-3-line" to="/tags/"
|
||||
title="标签"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="showItems">
|
||||
<YunNavMenuItem
|
||||
v-for="item, i in themeConfig.pages"
|
||||
:key="i"
|
||||
:icon="item.icon"
|
||||
:to="item.url"
|
||||
:title="item.name"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -172,6 +172,12 @@ export interface ThemeConfig extends DefaultTheme.Config {
|
|||
* @zh - 页面,显示在社交导航栏下方
|
||||
*/
|
||||
pages: PageProps[]
|
||||
/**
|
||||
* show items
|
||||
* @zh 左上角使用页面链接替换导航栏
|
||||
* @default false
|
||||
*/
|
||||
showItems?: boolean
|
||||
|
||||
sidebar: YunTheme.Sidebar
|
||||
|
||||
|
|
Loading…
Reference in New Issue