valaxy-theme-yun 0.14.27 → 0.14.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,8 @@ const aside = computed(() => props.frontmatter.aside !== false)
|
|
38
38
|
<slot name="main-content">
|
39
39
|
<Transition appear>
|
40
40
|
<ValaxyMd :frontmatter="frontmatter">
|
41
|
+
<YunMdTimeWarning :frontmatter="frontmatter" />
|
42
|
+
|
41
43
|
<slot name="main-content-md" />
|
42
44
|
<slot />
|
43
45
|
</ValaxyMd>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import { computed } from 'vue'
|
3
|
+
import type { Post } from 'valaxy'
|
4
|
+
|
5
|
+
import dayjs from 'dayjs'
|
6
|
+
import relativeTime from 'dayjs/plugin/relativeTime'
|
7
|
+
|
8
|
+
import { useI18n } from 'vue-i18n'
|
9
|
+
|
10
|
+
const props = defineProps<{
|
11
|
+
frontmatter: Post
|
12
|
+
}>()
|
13
|
+
|
14
|
+
dayjs.extend(relativeTime)
|
15
|
+
|
16
|
+
const { t } = useI18n()
|
17
|
+
|
18
|
+
/**
|
19
|
+
* when the post is updated more than 30 days ago, show a warning
|
20
|
+
* default 30 days, you can set `time_warning` in frontmatter to change it
|
21
|
+
*/
|
22
|
+
const time_warning = computed(() => {
|
23
|
+
const diff = dayjs().valueOf() - dayjs(props.frontmatter.updated).valueOf()
|
24
|
+
if (typeof props.frontmatter.time_warning === 'number')
|
25
|
+
return diff > props.frontmatter.time_warning
|
26
|
+
else
|
27
|
+
return props.frontmatter.time_warning || diff > 30 * 24 * 60 * 60 * 1000
|
28
|
+
})
|
29
|
+
</script>
|
30
|
+
|
31
|
+
<template>
|
32
|
+
<blockquote v-if="time_warning" op="80">
|
33
|
+
{{ t('post.time_warning', { ago: dayjs(frontmatter.updated).fromNow() }) }}
|
34
|
+
</blockquote>
|
35
|
+
</template>
|
@@ -35,9 +35,9 @@ const displayedPosts = computed(() =>
|
|
35
35
|
</div>
|
36
36
|
</template>
|
37
37
|
|
38
|
-
<
|
39
|
-
<YunPostCard :post="route" />
|
40
|
-
</
|
38
|
+
<TransitionGroup name="fade">
|
39
|
+
<YunPostCard v-for="route, i in displayedPosts" :key="i" :post="route" />
|
40
|
+
</TransitionGroup>
|
41
41
|
</div>
|
42
42
|
|
43
43
|
<ValaxyPagination :cur-page="curPage" :page-size="pageSize" :total="posts.length" />
|
package/components/YunTwikoo.vue
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.14.
|
3
|
+
"version": "0.14.29",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -18,12 +18,12 @@
|
|
18
18
|
"types": "types/index.d.ts",
|
19
19
|
"dependencies": {
|
20
20
|
"@iconify-json/ant-design": "^1.1.5",
|
21
|
-
"@iconify-json/simple-icons": "^1.1.
|
21
|
+
"@iconify-json/simple-icons": "^1.1.54",
|
22
22
|
"animejs": "^3.2.1",
|
23
23
|
"valaxy-addon-waline": "0.1.0"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"@types/animejs": "^3.1.7",
|
27
|
-
"valaxy": "0.14.
|
27
|
+
"valaxy": "0.14.29"
|
28
28
|
}
|
29
29
|
}
|