valaxy-theme-hairy 1.2.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/components/PageTags.vue +1 -1
- package/components/parts/HairyTimelineContent.vue +1 -4
- package/components/posts/HairyArticleImage.vue +10 -11
- package/components/posts/HairyArticleSeries.vue +1 -0
- package/components/posts/HairyUpdatedPost.vue +3 -3
- package/layouts/post.vue +1 -1
- package/library/loading.ts +0 -1
- package/package.json +1 -1
- package/pages/categories/[...its].vue +5 -8
- package/pages/tags/[tag]/index.vue +2 -2
package/components/PageTags.vue
CHANGED
@@ -4,7 +4,6 @@ import dayjs from 'dayjs'
|
|
4
4
|
import { withDefaults } from 'vue'
|
5
5
|
import { last } from 'lodash-es'
|
6
6
|
import { useRouter } from 'vue-router'
|
7
|
-
import { useI18n } from 'vue-i18n'
|
8
7
|
import { toArray } from '../../utils'
|
9
8
|
|
10
9
|
withDefaults(
|
@@ -17,8 +16,6 @@ withDefaults(
|
|
17
16
|
},
|
18
17
|
)
|
19
18
|
|
20
|
-
const i18n = useI18n()
|
21
|
-
|
22
19
|
const router = useRouter()
|
23
20
|
|
24
21
|
function displayCategory(keys: string | string[] = []) {
|
@@ -32,7 +29,7 @@ function displayCategory(keys: string | string[] = []) {
|
|
32
29
|
{{ dayjs(post.date).format(format) }}
|
33
30
|
</div>
|
34
31
|
<HairyLink v-if="post.categories?.length" bordered type="white" @click="displayCategory(post.categories)">
|
35
|
-
{{
|
32
|
+
{{ $t(last(toArray(post.categories)) || '', {}, { missingWarn: false }) }}
|
36
33
|
</HairyLink>
|
37
34
|
</div>
|
38
35
|
<a class="cursor-pointer text-size-4" @click="$router.push(post.path || '')">{{ post.title }}</a>
|
@@ -3,7 +3,6 @@ import type { Post } from 'valaxy'
|
|
3
3
|
import { computed, defineProps } from 'vue'
|
4
4
|
import dayjs from 'dayjs'
|
5
5
|
import { useRouter } from 'vue-router'
|
6
|
-
import { useI18n } from 'vue-i18n'
|
7
6
|
import { removeTags, toArray } from '../../utils'
|
8
7
|
import { useLayoutPost } from '../../composables'
|
9
8
|
|
@@ -17,7 +16,6 @@ const layout = useLayoutPost()
|
|
17
16
|
const slice = computed(() => layout.value.includes('slice'))
|
18
17
|
const image = computed(() => props.post.image?.toString())
|
19
18
|
const text = computed(() => removeTags(props.post.excerpt))
|
20
|
-
const i18n = useI18n()
|
21
19
|
function onReadMore() {
|
22
20
|
if (props.post.path)
|
23
21
|
router.push(props.post.path)
|
@@ -29,13 +27,15 @@ function displayCategory(keys: string | string[] = []) {
|
|
29
27
|
</script>
|
30
28
|
|
31
29
|
<template>
|
32
|
-
<li class="HairyArticleImage mb-10 py-2" :class="[slice && 'slice', reverse && 'reverse']">
|
30
|
+
<li class="HairyArticleImage mb-10 py-2 lt-sm:mb-5 lt-md:mb-6" :class="[slice && 'slice', reverse && 'reverse']">
|
33
31
|
<article>
|
34
32
|
<div class="flex justify-between items-center">
|
35
33
|
<a
|
36
|
-
class="text-size-2xl font-bold truncate cursor-pointer lt-sm:text-size-lg"
|
34
|
+
class="text-size-2xl lt-sm:max-w-200px font-bold truncate cursor-pointer lt-sm:text-size-lg"
|
37
35
|
:class="[reverse ? 'order-last' : 'order-first']" @click="onReadMore"
|
38
|
-
>
|
36
|
+
>
|
37
|
+
{{ post.title }}
|
38
|
+
</a>
|
39
39
|
<div class="flex justify-end gap-2 text-size-sm lt-sm:text-size-xs">
|
40
40
|
<span>{{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
|
41
41
|
<span>{{ post.wordCount }}字</span>
|
@@ -43,22 +43,22 @@ function displayCategory(keys: string | string[] = []) {
|
|
43
43
|
</div>
|
44
44
|
</div>
|
45
45
|
<div
|
46
|
-
class="h-200px lt-sm:h-
|
46
|
+
class="h-200px lt-sm:h-120px flex bg-light-2 dark:bg-transparent rounded-5"
|
47
47
|
:class="[reverse ? 'pl-4' : 'pr-4']"
|
48
48
|
>
|
49
49
|
<div class="flex-1 post-image-content" :class="[reverse ? 'order-last' : 'order-first']">
|
50
50
|
<img class="post-image rounded-1 w-full h-full object-cover cursor-pointer" :src="image" @click="onReadMore">
|
51
51
|
</div>
|
52
|
-
<div class="flex-1 flex flex-col justify-between py-2 dark:py-0">
|
52
|
+
<div class="flex-1 lt-md:flex-[1.2] flex flex-col justify-between py-2 dark:py-0">
|
53
53
|
<div class="flex-1 text-size-sm">
|
54
|
-
<div class="line-clamp-text">
|
54
|
+
<div class="line-clamp-text line-clamp-5 lt-sm:line-clamp-3">
|
55
55
|
{{ text }}
|
56
56
|
</div>
|
57
57
|
</div>
|
58
58
|
<div class="flex justify-between items-center">
|
59
|
-
<a class="cursor-pointer" :class="[reverse && 'order-1']">
|
59
|
+
<a class="cursor-pointer truncate lt-sm:max-w-120px" :class="[reverse && 'order-1']">
|
60
60
|
<span v-if="post.categories?.length" @click="displayCategory(post.categories)">
|
61
|
-
{{
|
61
|
+
{{ $t(toArray(post.categories).at(-1) || '', {}, { missingWarn: false }) }}
|
62
62
|
</span>
|
63
63
|
</a>
|
64
64
|
<div class="text-base leading-6 font-medium">
|
@@ -83,7 +83,6 @@ function displayCategory(keys: string | string[] = []) {
|
|
83
83
|
display: -webkit-box;
|
84
84
|
text-overflow: ellipsis;
|
85
85
|
-webkit-box-orient: vertical;
|
86
|
-
-webkit-line-clamp: 5;
|
87
86
|
}
|
88
87
|
|
89
88
|
.post-image {
|
@@ -35,7 +35,7 @@ function displayCategory(keys: string | string[] = []) {
|
|
35
35
|
最近更新:
|
36
36
|
</div>
|
37
37
|
<div class="flex-1 flex items-center justify-end gap-2 flex-wrap">
|
38
|
-
<HairyLink :href="post.path">
|
38
|
+
<HairyLink class="truncate lt-sm:max-w-220px" :href="post.path">
|
39
39
|
{{ post.title }}
|
40
40
|
</HairyLink>
|
41
41
|
<template v-if="post.tags?.length">
|
@@ -52,7 +52,7 @@ function displayCategory(keys: string | string[] = []) {
|
|
52
52
|
class="dark:bg-dark-50 cursor-pointer border-none!"
|
53
53
|
@click="$router.push(`/tags/${tag}`)"
|
54
54
|
>
|
55
|
-
{{ tag }}
|
55
|
+
{{ $t(tag, {}, { missingWarn: false }) }}
|
56
56
|
</ElTag>
|
57
57
|
</div>
|
58
58
|
</div>
|
@@ -64,7 +64,7 @@ function displayCategory(keys: string | string[] = []) {
|
|
64
64
|
<div class="lt-md:hidden flex items-center gap-2">
|
65
65
|
<div class="i-material-symbols-folder-open-rounded text-14px" />
|
66
66
|
<ElTag size="small" class="dark:bg-dark-50 cursor-pointer border-none!" @click="displayCategory(post.categories)">
|
67
|
-
{{ toArray(post.categories).map($t).join('/') }}
|
67
|
+
{{ toArray(post.categories).map((v) => $t(v, {}, { missingWarn: false })).join('/') }}
|
68
68
|
</ElTag>
|
69
69
|
</div>
|
70
70
|
</template>
|
package/layouts/post.vue
CHANGED
@@ -34,7 +34,7 @@ function displayTag(tag: string) {
|
|
34
34
|
</div>
|
35
35
|
<div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
|
36
36
|
<ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
|
37
|
-
{{ tag }}
|
37
|
+
{{ $t(tag, {}, { missingWarn: false }) }}
|
38
38
|
</ElTag>
|
39
39
|
</div>
|
40
40
|
</template>
|
package/library/loading.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed } from 'vue'
|
3
|
-
import { useI18n } from 'vue-i18n'
|
4
3
|
import { useRoute, useRouter } from 'vue-router'
|
5
4
|
import { useThemeConfig } from 'valaxy'
|
6
5
|
import { ElTimeline, ElTimelineItem } from 'element-plus'
|
@@ -19,8 +18,6 @@ const paths = computed(() => categories.value.split('/').filter(Boolean))
|
|
19
18
|
const current = useCategory(paths)
|
20
19
|
const posts = useCategoryPost(paths)
|
21
20
|
|
22
|
-
const i18n = useI18n()
|
23
|
-
|
24
21
|
function getBreadcrumbPath(index: number) {
|
25
22
|
const paths = categories.value.split('/').filter(Boolean)
|
26
23
|
if (paths[index] === paths[paths.length - 1])
|
@@ -42,12 +39,12 @@ function displayCategory(key: string) {
|
|
42
39
|
全部
|
43
40
|
</HairyBreadcrumbItem>
|
44
41
|
<HairyBreadcrumbItem v-for="(key, index) in categories.split('/')" :key="key" :to="getBreadcrumbPath(index)">
|
45
|
-
{{
|
42
|
+
{{ $t(key, {}, { missingWarn: false }) }}
|
46
43
|
</HairyBreadcrumbItem>
|
47
44
|
</HairyBreadcrumb>
|
48
45
|
|
49
46
|
<div class="grid__view dark:text-gray-3 flex-wrap">
|
50
|
-
<template v-for="([key
|
47
|
+
<template v-for="([key]) in current.children" :key="key">
|
51
48
|
<div
|
52
49
|
v-if="!key.startsWith('/post')"
|
53
50
|
class="relative flex items-center flex-col cursor-pointer hover:text-primary transition-colors"
|
@@ -55,11 +52,11 @@ function displayCategory(key: string) {
|
|
55
52
|
>
|
56
53
|
<div class="i-material-symbols-folder-open-rounded text-22 lt-sm:text-15" />
|
57
54
|
<div class="text-center leading-normal">
|
58
|
-
{{
|
55
|
+
{{ $t(key, {}, { missingWarn: false }) }}
|
59
56
|
</div>
|
60
|
-
<div class="badge text-12px right-20px top-12px">
|
57
|
+
<!-- <div class="badge text-12px right-20px top-12px">
|
61
58
|
{{ item.total }} dir
|
62
|
-
</div>
|
59
|
+
</div> -->
|
63
60
|
</div>
|
64
61
|
</template>
|
65
62
|
</div>
|
@@ -4,7 +4,7 @@ import { usePostList } from 'valaxy'
|
|
4
4
|
import { ElTimeline, ElTimelineItem } from 'element-plus'
|
5
5
|
import { useRoute } from 'vue-router'
|
6
6
|
|
7
|
-
const tag = computed(() => useRoute().params.tag)
|
7
|
+
const tag = computed(() => useRoute().params.tag as string)
|
8
8
|
|
9
9
|
const posts = computed<any[]>(() =>
|
10
10
|
usePostList().value.filter(post => post.tags?.includes(tag.value as string)),
|
@@ -17,7 +17,7 @@ const posts = computed<any[]>(() =>
|
|
17
17
|
首页
|
18
18
|
</HairyBreadcrumbItem>
|
19
19
|
<HairyBreadcrumbItem>
|
20
|
-
{{ tag }}
|
20
|
+
{{ $t(tag, {}, { missingWarn: false }) }}
|
21
21
|
</HairyBreadcrumbItem>
|
22
22
|
</HairyBreadcrumb>
|
23
23
|
<ElTimeline>
|