@sugarat/theme 0.1.22 → 0.1.24
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.
package/node.d.ts
CHANGED
|
@@ -84,6 +84,12 @@ declare namespace Theme {
|
|
|
84
84
|
title?: string;
|
|
85
85
|
pageSize?: number;
|
|
86
86
|
nextText?: string;
|
|
87
|
+
/**
|
|
88
|
+
* 是否展示当前正在浏览的文章在左侧
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
showSelf?: boolean;
|
|
92
|
+
filter?: (page: Theme.PageData) => boolean;
|
|
87
93
|
empty?: string | boolean;
|
|
88
94
|
}
|
|
89
95
|
interface HomeBlog {
|
package/package.json
CHANGED
|
@@ -24,9 +24,15 @@
|
|
|
24
24
|
<!-- 简介 -->
|
|
25
25
|
<div class="des">
|
|
26
26
|
<!-- title -->
|
|
27
|
-
<el-link
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
<el-link
|
|
28
|
+
type="info"
|
|
29
|
+
class="title"
|
|
30
|
+
:class="{
|
|
31
|
+
current: isCurrentDoc(v.route)
|
|
32
|
+
}"
|
|
33
|
+
:href="v.route"
|
|
34
|
+
>{{ v.meta.title }}</el-link
|
|
35
|
+
>
|
|
30
36
|
<!-- 描述信息 -->
|
|
31
37
|
<div class="suffix">
|
|
32
38
|
<!-- 日期 -->
|
|
@@ -57,7 +63,9 @@ const docs = useArticles()
|
|
|
57
63
|
const route = useRoute()
|
|
58
64
|
|
|
59
65
|
const recommendList = computed(() => {
|
|
60
|
-
|
|
66
|
+
// 中文支持
|
|
67
|
+
const paths = decodeURIComponent(route.path).split('/')
|
|
68
|
+
|
|
61
69
|
const origin = docs.value
|
|
62
70
|
.map((v) => ({ ...v, route: withBase(v.route) }))
|
|
63
71
|
// 过滤出公共路由前缀
|
|
@@ -70,9 +78,14 @@ const recommendList = computed(() => {
|
|
|
70
78
|
// 过滤出带标题的
|
|
71
79
|
.filter((v) => !!v.meta.title)
|
|
72
80
|
// 过滤掉自己
|
|
73
|
-
.filter(
|
|
81
|
+
.filter(
|
|
82
|
+
(v) =>
|
|
83
|
+
(recommend?.showSelf ?? true) ||
|
|
84
|
+
v.route !== decodeURIComponent(route.path).replace(/.html$/, '')
|
|
85
|
+
)
|
|
74
86
|
// 过滤掉不需要展示的
|
|
75
87
|
.filter((v) => v.meta.recommend !== false)
|
|
88
|
+
.filter((v) => recommend?.filter?.(v) ?? true)
|
|
76
89
|
|
|
77
90
|
const topList = origin.filter((v) => v.meta?.recommend)
|
|
78
91
|
topList.sort((a, b) => Number(a.meta.recommend) - Number(b.meta.recommend))
|
|
@@ -82,6 +95,11 @@ const recommendList = computed(() => {
|
|
|
82
95
|
|
|
83
96
|
return topList.concat(normalList)
|
|
84
97
|
})
|
|
98
|
+
|
|
99
|
+
const isCurrentDoc = (value: string) => {
|
|
100
|
+
return value === decodeURIComponent(route.path).replace(/.html$/, '')
|
|
101
|
+
}
|
|
102
|
+
|
|
85
103
|
const currentPage = ref(1)
|
|
86
104
|
const changePage = () => {
|
|
87
105
|
const newIdx =
|
|
@@ -158,6 +176,9 @@ const showChangeBtn = computed(() => {
|
|
|
158
176
|
color: var(--vp-c-text-1);
|
|
159
177
|
word-break: break-all;
|
|
160
178
|
white-space: break-spaces;
|
|
179
|
+
&.current {
|
|
180
|
+
color: var(--vp-c-brand);
|
|
181
|
+
}
|
|
161
182
|
}
|
|
162
183
|
|
|
163
184
|
.suffix {
|