valaxy-theme-hairy 1.2.1 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- {{ i18n.t(last(toArray(post.categories)) || '') }}
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
- >{{ post.title }}</a>
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-150px flex bg-light-2 dark:bg-transparent rounded-5"
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
- {{ i18n.t(toArray(post.categories).at(-1) || '') }}
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 {
@@ -57,6 +57,7 @@ async function changePost(path = '') {
57
57
  line-height: 28px;
58
58
  color: var(--va-c-text-light);
59
59
  white-space: nowrap;
60
+ overflow: hidden;
60
61
  text-overflow: ellipsis;
61
62
  transition: color 0.5s;
62
63
  cursor: pointer;
@@ -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">
@@ -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>
@@ -6,11 +6,10 @@ import { createDeferred } from '../utils'
6
6
 
7
7
  let el: HTMLElement
8
8
 
9
- showFullLoading()
10
-
11
9
  export const deferred = createDeferred<void>()
12
10
 
13
11
  export function install({ router }: ViteSSGContext) {
12
+ showFullLoading()
14
13
  loadFonts('Seto', Seto)
15
14
  router.afterEach(() => deferred.then(hideFullLoading))
16
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-hairy",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "packageManager": "pnpm@8.15.8",
5
5
  "author": {
6
6
  "email": "wwu710632@gmail.com",
@@ -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
- {{ i18n.t(key) }}
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, item]) in current.children" :key="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
- {{ i18n.t(key) }}
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>