valaxy-theme-hairy 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/client/index.ts +1 -1
- package/components/HairyBody.vue +49 -49
- package/components/HairyCodepen.vue +40 -40
- package/components/HairyComment.vue +33 -33
- package/components/HairyContainer.vue +17 -17
- package/components/HairyDrawer.vue +44 -44
- package/components/HairyFooter.vue +62 -62
- package/components/HairyHeader.vue +32 -32
- package/components/HairyImage.vue +15 -15
- package/components/HairyImageGroup.vue +65 -65
- package/components/HairyNavbar.vue +56 -56
- package/components/HairyPageArchives.vue +59 -59
- package/components/HairyPageTags.vue +48 -48
- package/components/HairyPosts.vue +54 -54
- package/components/HairySearch.vue +201 -201
- package/components/HairySidebar.vue +30 -30
- package/components/HairyTabbar.vue +56 -56
- package/components/PageTags.vue +48 -48
- package/components/ValaxyMain.vue +45 -45
- package/components/navbar/HairyNav.vue +16 -16
- package/components/navbar/HairyNavExpand.vue +12 -12
- package/components/navbar/HairyNavItem.vue +35 -35
- package/components/navbar/HairyNavbarBackground.vue +7 -7
- package/components/navbar/HairyNavbarSearch.vue +8 -8
- package/components/navbar/HairyNavbarTitle.vue +15 -15
- package/components/navbar/HairyNavbarToggleDark.vue +22 -22
- package/components/parts/HairyBreadcrumb.vue +51 -51
- package/components/parts/HairyBreadcrumbItem.vue +11 -11
- package/components/parts/HairyFootFish.js +352 -352
- package/components/parts/HairyFootFish.vue +38 -38
- package/components/parts/HairyHeadHero.vue +34 -34
- package/components/parts/HairyHeadWaves.vue +67 -67
- package/components/parts/HairyImageGlobal.vue +51 -51
- package/components/parts/HairyImageViewer.vue +23 -23
- package/components/parts/HairyLink.vue +21 -21
- package/components/parts/HairyMenu.vue +16 -16
- package/components/parts/HairyMenuItem.vue +47 -47
- package/components/parts/HairyOutline.vue +99 -99
- package/components/parts/HairyOutlineItem.vue +48 -48
- package/components/parts/HairySocialLinks.vue +27 -27
- package/components/parts/HairyTimelineContent.vue +39 -39
- package/components/parts/HairyUserNav.vue +95 -95
- package/components/parts/HairyUserStats.vue +18 -18
- package/components/posts/HairyArticleImage.vue +126 -126
- package/components/posts/HairyArticleSeries.vue +89 -89
- package/components/posts/HairyArticleText.vue +43 -43
- package/components/posts/HairyPostFooter.vue +15 -15
- package/components/posts/HairyPostImageList.vue +27 -27
- package/components/posts/HairyPostTextsList.vue +22 -22
- package/components/posts/HairyPostToggleLayout.vue +36 -36
- package/components/third/HairyAlgoliaSearch.vue +17 -17
- package/components/third/HairyFuseSearch.vue +10 -10
- package/components/third/HairyFuseSearchDialog.vue +32 -32
- package/components/third/HairyFuseSearchDropdown.vue +77 -77
- package/components/third/HairyFuseSearchFooter.vue +28 -28
- package/components/third/HairyFuseSearchHeader.vue +30 -30
- package/components/third/HairyFuseSearchHit.vue +52 -52
- package/components/third/HairySearchBtnDisplay.vue +29 -29
- package/components/third/HairySearchBtnInput.vue +20 -20
- package/components/third/HairySearchBtnKeys.vue +19 -19
- package/components/third/HairySwiperCarousel.vue +45 -45
- package/composables/archives.ts +48 -48
- package/composables/category.ts +43 -43
- package/composables/config.ts +11 -11
- package/composables/dark.ts +13 -13
- package/composables/fuse.ts +60 -60
- package/composables/index.ts +7 -7
- package/composables/layout.ts +16 -16
- package/composables/outline.ts +49 -49
- package/composables/tags.ts +36 -36
- package/layouts/archive-month.vue +13 -13
- package/layouts/archive-year.vue +13 -13
- package/layouts/archives.vue +11 -11
- package/layouts/categories.vue +13 -13
- package/layouts/default.vue +13 -15
- package/layouts/home.vue +33 -33
- package/layouts/post.vue +54 -54
- package/layouts/tag.vue +10 -10
- package/layouts/tags.vue +10 -14
- package/library/loading.scss +535 -535
- package/library/loading.ts +60 -60
- package/library/scroll.ts +22 -22
- package/locales/en.yml +1 -1
- package/locales/zh-CN.yml +1 -1
- package/node/images/default.json +139 -139
- package/node/images/index.ts +46 -46
- package/node/images/shims.d.ts +8 -8
- package/node/index.ts +2 -2
- package/node/theme/index.ts +78 -78
- package/package.json +1 -1
- package/pages/archives/[year]/[month]/index.vue +48 -48
- package/pages/archives/[year]/index.vue +73 -73
- package/pages/archives/index.md +6 -0
- package/pages/categories/[...its].vue +108 -108
- package/pages/index.vue +8 -8
- package/pages/page/[page].vue +12 -12
- package/pages/tags/[tag]/index.vue +38 -38
- package/pages/tags/index.md +7 -0
- package/setup/main.ts +9 -9
- package/store/index.ts +1 -1
- package/store/modules/global.ts +12 -12
- package/styles/components/aplayer.scss +75 -75
- package/styles/components/index.scss +3 -3
- package/styles/components/markdown.scss +89 -89
- package/styles/components/nprogress.scss +15 -15
- package/styles/components/scrollbar.scss +25 -25
- package/styles/css-vars.scss +171 -171
- package/styles/element-plus/index.scss +1 -1
- package/styles/element-plus/tabs.scss +25 -25
- package/styles/element-plus/timeline.scss +18 -18
- package/styles/font-face.scss +19 -19
- package/styles/global.scss +38 -38
- package/styles/index.scss +3 -3
- package/tsconfig.json +27 -27
- package/types/index.d.ts +163 -163
- package/unocss.config.ts +43 -43
- package/utils/index.ts +37 -37
- package/valaxy.config.ts +26 -26
- package/pages/archives/index.vue +0 -6
- package/pages/tags/index.vue +0 -6
package/composables/outline.ts
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
import { defineStore } from 'pinia'
|
2
|
-
import type { MenuItem } from 'valaxy'
|
3
|
-
import { getHeaders, onContentUpdated, useFrontmatter, useThemeConfig } from 'valaxy'
|
4
|
-
import type { DefaultTheme } from 'valaxy/types'
|
5
|
-
import { computed } from 'vue'
|
6
|
-
import { useRoute } from 'vue-router'
|
7
|
-
|
8
|
-
const useOutlineStore = defineStore('OutlineStore', {
|
9
|
-
state: () => ({} as Record<string, MenuItem[]>),
|
10
|
-
})
|
11
|
-
|
12
|
-
/**
|
13
|
-
* export headers & handleClick to generate outline
|
14
|
-
*/
|
15
|
-
export function useOutline() {
|
16
|
-
const frontmatter = useFrontmatter()
|
17
|
-
const themeConfig = useThemeConfig()
|
18
|
-
const route = useRoute()
|
19
|
-
const store = useOutlineStore()
|
20
|
-
|
21
|
-
const pageOutline = computed<DefaultTheme.Config['outline']>(
|
22
|
-
() => frontmatter.value.outline ?? themeConfig.value.outline,
|
23
|
-
)
|
24
|
-
|
25
|
-
const headers = computed(() => store.$state[route.path] || [])
|
26
|
-
|
27
|
-
onContentUpdated(() => {
|
28
|
-
if (pageOutline.value === false)
|
29
|
-
return
|
30
|
-
store.$state[route.path] = getHeaders(pageOutline.value)
|
31
|
-
})
|
32
|
-
|
33
|
-
const handleClick = ({ target: el }: Event) => {
|
34
|
-
const id = (el as HTMLAnchorElement).href!.split('#')[1]
|
35
|
-
const heading = document.getElementById(decodeURIComponent(id)) as HTMLAnchorElement
|
36
|
-
heading?.focus({ preventScroll: true })
|
37
|
-
}
|
38
|
-
|
39
|
-
return {
|
40
|
-
/**
|
41
|
-
* headers for toc
|
42
|
-
*/
|
43
|
-
headers,
|
44
|
-
/**
|
45
|
-
* click hash heading
|
46
|
-
*/
|
47
|
-
handleClick,
|
48
|
-
}
|
49
|
-
}
|
1
|
+
import { defineStore } from 'pinia'
|
2
|
+
import type { MenuItem } from 'valaxy'
|
3
|
+
import { getHeaders, onContentUpdated, useFrontmatter, useThemeConfig } from 'valaxy'
|
4
|
+
import type { DefaultTheme } from 'valaxy/types'
|
5
|
+
import { computed } from 'vue'
|
6
|
+
import { useRoute } from 'vue-router'
|
7
|
+
|
8
|
+
const useOutlineStore = defineStore('OutlineStore', {
|
9
|
+
state: () => ({} as Record<string, MenuItem[]>),
|
10
|
+
})
|
11
|
+
|
12
|
+
/**
|
13
|
+
* export headers & handleClick to generate outline
|
14
|
+
*/
|
15
|
+
export function useOutline() {
|
16
|
+
const frontmatter = useFrontmatter()
|
17
|
+
const themeConfig = useThemeConfig()
|
18
|
+
const route = useRoute()
|
19
|
+
const store = useOutlineStore()
|
20
|
+
|
21
|
+
const pageOutline = computed<DefaultTheme.Config['outline']>(
|
22
|
+
() => frontmatter.value.outline ?? themeConfig.value.outline,
|
23
|
+
)
|
24
|
+
|
25
|
+
const headers = computed(() => store.$state[route.path] || [])
|
26
|
+
|
27
|
+
onContentUpdated(() => {
|
28
|
+
if (pageOutline.value === false)
|
29
|
+
return
|
30
|
+
store.$state[route.path] = getHeaders(pageOutline.value)
|
31
|
+
})
|
32
|
+
|
33
|
+
const handleClick = ({ target: el }: Event) => {
|
34
|
+
const id = (el as HTMLAnchorElement).href!.split('#')[1]
|
35
|
+
const heading = document.getElementById(decodeURIComponent(id)) as HTMLAnchorElement
|
36
|
+
heading?.focus({ preventScroll: true })
|
37
|
+
}
|
38
|
+
|
39
|
+
return {
|
40
|
+
/**
|
41
|
+
* headers for toc
|
42
|
+
*/
|
43
|
+
headers,
|
44
|
+
/**
|
45
|
+
* click hash heading
|
46
|
+
*/
|
47
|
+
handleClick,
|
48
|
+
}
|
49
|
+
}
|
package/composables/tags.ts
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
import { TinyColor } from '@ctrl/tinycolor'
|
2
|
-
import { useTags } from 'valaxy'
|
3
|
-
|
4
|
-
/**
|
5
|
-
* get utils about tags
|
6
|
-
*/
|
7
|
-
export function useHairyTags(options: {
|
8
|
-
/**
|
9
|
-
* Primary Color
|
10
|
-
*/
|
11
|
-
primary: string
|
12
|
-
} = {
|
13
|
-
primary: '#0078E7',
|
14
|
-
}) {
|
15
|
-
const tags = useTags()
|
16
|
-
|
17
|
-
const gray = new TinyColor('#999999')
|
18
|
-
const primaryColor = new TinyColor(options.primary)
|
19
|
-
|
20
|
-
const getTagStyle = (count: number) => {
|
21
|
-
const counts = Array.from(tags.value).map(([_, value]) => value.count)
|
22
|
-
const max = Math.max(...counts)
|
23
|
-
const min = Math.min(...counts)
|
24
|
-
const range = max - min
|
25
|
-
const percent = (count - min) / range
|
26
|
-
return {
|
27
|
-
'--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
|
28
|
-
'fontSize': `${percent * 36 + 12}px`,
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
return {
|
33
|
-
tags,
|
34
|
-
getTagStyle,
|
35
|
-
}
|
36
|
-
}
|
1
|
+
import { TinyColor } from '@ctrl/tinycolor'
|
2
|
+
import { useTags } from 'valaxy'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* get utils about tags
|
6
|
+
*/
|
7
|
+
export function useHairyTags(options: {
|
8
|
+
/**
|
9
|
+
* Primary Color
|
10
|
+
*/
|
11
|
+
primary: string
|
12
|
+
} = {
|
13
|
+
primary: '#0078E7',
|
14
|
+
}) {
|
15
|
+
const tags = useTags()
|
16
|
+
|
17
|
+
const gray = new TinyColor('#999999')
|
18
|
+
const primaryColor = new TinyColor(options.primary)
|
19
|
+
|
20
|
+
const getTagStyle = (count: number) => {
|
21
|
+
const counts = Array.from(tags.value).map(([_, value]) => value.count)
|
22
|
+
const max = Math.max(...counts)
|
23
|
+
const min = Math.min(...counts)
|
24
|
+
const range = max - min
|
25
|
+
const percent = (count - min) / range
|
26
|
+
return {
|
27
|
+
'--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
|
28
|
+
'fontSize': `${percent * 36 + 12}px`,
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return {
|
33
|
+
tags,
|
34
|
+
getTagStyle,
|
35
|
+
}
|
36
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
</script>
|
3
|
-
|
4
|
-
<template>
|
5
|
-
<HairyContainer>
|
6
|
-
<HairyNavbar />
|
7
|
-
<HairyHeader :title="`发表于'${$route.params.year}年${$route.params.month}月'的文章`" />
|
8
|
-
<HairyBody>
|
9
|
-
<router-view />
|
10
|
-
</HairyBody>
|
11
|
-
<HairyFooter />
|
12
|
-
</HairyContainer>
|
13
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
</script>
|
3
|
+
|
4
|
+
<template>
|
5
|
+
<HairyContainer>
|
6
|
+
<HairyNavbar />
|
7
|
+
<HairyHeader :title="`发表于'${$route.params.year}年${$route.params.month}月'的文章`" />
|
8
|
+
<HairyBody>
|
9
|
+
<router-view />
|
10
|
+
</HairyBody>
|
11
|
+
<HairyFooter />
|
12
|
+
</HairyContainer>
|
13
|
+
</template>
|
package/layouts/archive-year.vue
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
</script>
|
3
|
-
|
4
|
-
<template>
|
5
|
-
<HairyContainer>
|
6
|
-
<HairyNavbar />
|
7
|
-
<HairyHeader :title="`发表于'${$route.params.year}年'的文章`" />
|
8
|
-
<HairyBody>
|
9
|
-
<router-view />
|
10
|
-
</HairyBody>
|
11
|
-
<HairyFooter />
|
12
|
-
</HairyContainer>
|
13
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
</script>
|
3
|
+
|
4
|
+
<template>
|
5
|
+
<HairyContainer>
|
6
|
+
<HairyNavbar />
|
7
|
+
<HairyHeader :title="`发表于'${$route.params.year}年'的文章`" />
|
8
|
+
<HairyBody>
|
9
|
+
<router-view />
|
10
|
+
</HairyBody>
|
11
|
+
<HairyFooter />
|
12
|
+
</HairyContainer>
|
13
|
+
</template>
|
package/layouts/archives.vue
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
<template>
|
2
|
-
<HairyContainer>
|
3
|
-
<HairyNavbar />
|
4
|
-
<HairyHeader />
|
5
|
-
<HairyBody>
|
6
|
-
<HairyPageArchives />
|
7
|
-
</HairyBody>
|
8
|
-
<HairyFooter />
|
9
|
-
<HairyDrawer />
|
10
|
-
</HairyContainer>
|
11
|
-
</template>
|
1
|
+
<template>
|
2
|
+
<HairyContainer>
|
3
|
+
<HairyNavbar />
|
4
|
+
<HairyHeader />
|
5
|
+
<HairyBody>
|
6
|
+
<HairyPageArchives />
|
7
|
+
</HairyBody>
|
8
|
+
<HairyFooter />
|
9
|
+
<HairyDrawer />
|
10
|
+
</HairyContainer>
|
11
|
+
</template>
|
package/layouts/categories.vue
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
</script>
|
3
|
-
|
4
|
-
<template>
|
5
|
-
<HairyContainer>
|
6
|
-
<HairyNavbar />
|
7
|
-
<HairyHeader title="分类" />
|
8
|
-
<HairyBody>
|
9
|
-
<router-view />
|
10
|
-
</HairyBody>
|
11
|
-
<HairyFooter />
|
12
|
-
</HairyContainer>
|
13
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
</script>
|
3
|
+
|
4
|
+
<template>
|
5
|
+
<HairyContainer>
|
6
|
+
<HairyNavbar />
|
7
|
+
<HairyHeader title="分类" />
|
8
|
+
<HairyBody>
|
9
|
+
<router-view />
|
10
|
+
</HairyBody>
|
11
|
+
<HairyFooter />
|
12
|
+
</HairyContainer>
|
13
|
+
</template>
|
package/layouts/default.vue
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
</script>
|
3
|
-
|
4
|
-
<template>
|
5
|
-
<HairyContainer>
|
6
|
-
<HairyNavbar />
|
7
|
-
<HairyHeader />
|
8
|
-
<HairyBody>
|
9
|
-
<router-view />
|
10
|
-
</HairyBody>
|
11
|
-
<HairyFooter />
|
12
|
-
</HairyContainer>
|
13
|
-
</template>
|
14
|
-
|
15
|
-
|
1
|
+
<script lang="ts" setup>
|
2
|
+
</script>
|
3
|
+
|
4
|
+
<template>
|
5
|
+
<HairyContainer>
|
6
|
+
<HairyNavbar />
|
7
|
+
<HairyHeader />
|
8
|
+
<HairyBody>
|
9
|
+
<router-view />
|
10
|
+
</HairyBody>
|
11
|
+
<HairyFooter />
|
12
|
+
</HairyContainer>
|
13
|
+
</template>
|
package/layouts/home.vue
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { useSiteConfig } from 'valaxy'
|
3
|
-
import dayjs from 'dayjs'
|
4
|
-
import { riposte } from '../utils'
|
5
|
-
|
6
|
-
const config = useSiteConfig()
|
7
|
-
|
8
|
-
const hour = dayjs().hour()
|
9
|
-
const hello = riposte(
|
10
|
-
[hour >= 5 && hour < 12, 'Good morning'],
|
11
|
-
[hour >= 12 && hour < 18, 'Good afternoon'],
|
12
|
-
[true, 'Good evening'],
|
13
|
-
)
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<template>
|
17
|
-
<HairyContainer>
|
18
|
-
<HairyNavbar>
|
19
|
-
<template #nav>
|
20
|
-
<slot name="header-nav" />
|
21
|
-
</template>
|
22
|
-
</HairyNavbar>
|
23
|
-
<HairyHeader
|
24
|
-
:headline="config.title"
|
25
|
-
:title="config.author.name"
|
26
|
-
:description="`${hello}, how are you doing?`"
|
27
|
-
/>
|
28
|
-
<HairyBody>
|
29
|
-
<router-view />
|
30
|
-
</HairyBody>
|
31
|
-
<HairyFooter />
|
32
|
-
</HairyContainer>
|
33
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { useSiteConfig } from 'valaxy'
|
3
|
+
import dayjs from 'dayjs'
|
4
|
+
import { riposte } from '../utils'
|
5
|
+
|
6
|
+
const config = useSiteConfig()
|
7
|
+
|
8
|
+
const hour = dayjs().hour()
|
9
|
+
const hello = riposte(
|
10
|
+
[hour >= 5 && hour < 12, 'Good morning'],
|
11
|
+
[hour >= 12 && hour < 18, 'Good afternoon'],
|
12
|
+
[true, 'Good evening'],
|
13
|
+
)
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<template>
|
17
|
+
<HairyContainer>
|
18
|
+
<HairyNavbar>
|
19
|
+
<template #nav>
|
20
|
+
<slot name="header-nav" />
|
21
|
+
</template>
|
22
|
+
</HairyNavbar>
|
23
|
+
<HairyHeader
|
24
|
+
:headline="config.title"
|
25
|
+
:title="config.author.name"
|
26
|
+
:description="`${hello}, how are you doing?`"
|
27
|
+
/>
|
28
|
+
<HairyBody>
|
29
|
+
<router-view />
|
30
|
+
</HairyBody>
|
31
|
+
<HairyFooter />
|
32
|
+
</HairyContainer>
|
33
|
+
</template>
|
package/layouts/post.vue
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
<script lang="ts" setup>
|
2
|
-
import { dayjs } from 'element-plus'
|
3
|
-
import { useFrontmatter } from 'valaxy'
|
4
|
-
import { useRouter } from 'vue-router'
|
5
|
-
|
6
|
-
import 'element-plus/theme-chalk/el-tag.css'
|
7
|
-
|
8
|
-
defineProps<{
|
9
|
-
header?: {
|
10
|
-
title?: string
|
11
|
-
headline?: string
|
12
|
-
description?: string
|
13
|
-
}
|
14
|
-
}>()
|
15
|
-
|
16
|
-
const router = useRouter()
|
17
|
-
const post = useFrontmatter()
|
18
|
-
|
19
|
-
function displayTag(tag: string) {
|
20
|
-
router.push(`/tags/${tag}`)
|
21
|
-
}
|
22
|
-
</script>
|
23
|
-
|
24
|
-
<template>
|
25
|
-
<HairyContainer>
|
26
|
-
<HairyNavbar />
|
27
|
-
<HairyHeader :title="post.title">
|
28
|
-
<template #description>
|
29
|
-
<div class="flex gap-2">
|
30
|
-
<span>发表于 {{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
|
31
|
-
<span>本文字数 {{ post.wordCount }} 字</span>
|
32
|
-
<span>阅读时长 {{ post.readingTime }} 分钟</span>
|
33
|
-
</div>
|
34
|
-
<div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
|
35
|
-
<ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
|
36
|
-
{{ tag }}
|
37
|
-
</ElTag>
|
38
|
-
</div>
|
39
|
-
</template>
|
40
|
-
</HairyHeader>
|
41
|
-
<HairyBody>
|
42
|
-
<template #default>
|
43
|
-
<HairyImageGlobal>
|
44
|
-
<router-view />
|
45
|
-
</HairyImageGlobal>
|
46
|
-
<HairyPostFooter />
|
47
|
-
</template>
|
48
|
-
<template #slide>
|
49
|
-
<HairyTabbar />
|
50
|
-
</template>
|
51
|
-
</HairyBody>
|
52
|
-
<HairyFooter />
|
53
|
-
</HairyContainer>
|
54
|
-
</template>
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { ElTag, dayjs } from 'element-plus'
|
3
|
+
import { useFrontmatter } from 'valaxy'
|
4
|
+
import { useRouter } from 'vue-router'
|
5
|
+
|
6
|
+
import 'element-plus/theme-chalk/el-tag.css'
|
7
|
+
|
8
|
+
defineProps<{
|
9
|
+
header?: {
|
10
|
+
title?: string
|
11
|
+
headline?: string
|
12
|
+
description?: string
|
13
|
+
}
|
14
|
+
}>()
|
15
|
+
|
16
|
+
const router = useRouter()
|
17
|
+
const post = useFrontmatter()
|
18
|
+
|
19
|
+
function displayTag(tag: string) {
|
20
|
+
router.push(`/tags/${tag}`)
|
21
|
+
}
|
22
|
+
</script>
|
23
|
+
|
24
|
+
<template>
|
25
|
+
<HairyContainer>
|
26
|
+
<HairyNavbar />
|
27
|
+
<HairyHeader :title="post.title">
|
28
|
+
<template #description>
|
29
|
+
<div class="flex gap-2">
|
30
|
+
<span>发表于 {{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
|
31
|
+
<span>本文字数 {{ post.wordCount }} 字</span>
|
32
|
+
<span>阅读时长 {{ post.readingTime }} 分钟</span>
|
33
|
+
</div>
|
34
|
+
<div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
|
35
|
+
<ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
|
36
|
+
{{ tag }}
|
37
|
+
</ElTag>
|
38
|
+
</div>
|
39
|
+
</template>
|
40
|
+
</HairyHeader>
|
41
|
+
<HairyBody>
|
42
|
+
<template #default>
|
43
|
+
<HairyImageGlobal>
|
44
|
+
<router-view />
|
45
|
+
</HairyImageGlobal>
|
46
|
+
<HairyPostFooter />
|
47
|
+
</template>
|
48
|
+
<template #slide>
|
49
|
+
<HairyTabbar />
|
50
|
+
</template>
|
51
|
+
</HairyBody>
|
52
|
+
<HairyFooter />
|
53
|
+
</HairyContainer>
|
54
|
+
</template>
|
package/layouts/tag.vue
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
<template>
|
2
|
-
<HairyContainer>
|
3
|
-
<HairyNavbar />
|
4
|
-
<HairyHeader :title="`包含标签'${$route.params.tag}'的标签`" />
|
5
|
-
<HairyBody>
|
6
|
-
<router-view />
|
7
|
-
</HairyBody>
|
8
|
-
<HairyFooter />
|
9
|
-
</HairyContainer>
|
10
|
-
</template>
|
1
|
+
<template>
|
2
|
+
<HairyContainer>
|
3
|
+
<HairyNavbar />
|
4
|
+
<HairyHeader :title="`包含标签'${$route.params.tag}'的标签`" />
|
5
|
+
<HairyBody>
|
6
|
+
<router-view />
|
7
|
+
</HairyBody>
|
8
|
+
<HairyFooter />
|
9
|
+
</HairyContainer>
|
10
|
+
</template>
|
package/layouts/tags.vue
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
</HairyBody>
|
12
|
-
<HairyFooter />
|
13
|
-
</HairyContainer>
|
14
|
-
</template>
|
1
|
+
<template>
|
2
|
+
<HairyContainer>
|
3
|
+
<HairyNavbar />
|
4
|
+
<HairyHeader title="所有标签" />
|
5
|
+
<HairyBody>
|
6
|
+
<HairyPageTags />
|
7
|
+
</HairyBody>
|
8
|
+
<HairyFooter />
|
9
|
+
</HairyContainer>
|
10
|
+
</template>
|