@sugarat/theme 0.1.21 → 0.1.23
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
|
@@ -57,7 +57,9 @@ const docs = useArticles()
|
|
|
57
57
|
const route = useRoute()
|
|
58
58
|
|
|
59
59
|
const recommendList = computed(() => {
|
|
60
|
-
|
|
60
|
+
// 中文支持
|
|
61
|
+
const paths = decodeURIComponent(route.path).split('/')
|
|
62
|
+
|
|
61
63
|
const origin = docs.value
|
|
62
64
|
.map((v) => ({ ...v, route: withBase(v.route) }))
|
|
63
65
|
// 过滤出公共路由前缀
|
|
@@ -70,9 +72,14 @@ const recommendList = computed(() => {
|
|
|
70
72
|
// 过滤出带标题的
|
|
71
73
|
.filter((v) => !!v.meta.title)
|
|
72
74
|
// 过滤掉自己
|
|
73
|
-
.filter(
|
|
75
|
+
.filter(
|
|
76
|
+
(v) =>
|
|
77
|
+
(recommend?.showSelf ?? true) ||
|
|
78
|
+
v.route !== decodeURIComponent(route.path).replace(/.html$/, '')
|
|
79
|
+
)
|
|
74
80
|
// 过滤掉不需要展示的
|
|
75
81
|
.filter((v) => v.meta.recommend !== false)
|
|
82
|
+
.filter((v) => recommend?.filter?.(v) ?? true)
|
|
76
83
|
|
|
77
84
|
const topList = origin.filter((v) => v.meta?.recommend)
|
|
78
85
|
topList.sort((a, b) => Number(a.meta.recommend) - Number(b.meta.recommend))
|
|
@@ -186,7 +186,12 @@ const searchModal = ref(false)
|
|
|
186
186
|
const searchWords = ref('')
|
|
187
187
|
const docs = useArticles()
|
|
188
188
|
|
|
189
|
-
const keys = useMagicKeys(
|
|
189
|
+
const keys = useMagicKeys({
|
|
190
|
+
passive: false,
|
|
191
|
+
onEventFired(e) {
|
|
192
|
+
if (e.ctrlKey && e.key === 'k' && e.type === 'keydown') e.preventDefault()
|
|
193
|
+
}
|
|
194
|
+
})
|
|
190
195
|
const CmdK = keys['Meta+K']
|
|
191
196
|
const CtrlK = keys['Ctrl+K']
|
|
192
197
|
// eslint-disable-next-line dot-notation, prefer-destructuring
|