From 2dbbc79a757a6ea21a01a239414ead137314dcf6 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Mon, 8 Jan 2024 16:05:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E9=85=8D=E7=BD=AE=E4=B8=8B=E7=9A=84=E9=A2=84=E8=AE=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20#40?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin-notes-data/src/node/prepareNotesData.ts | 5 ++++- theme/src/client/components/Home.vue | 8 ++++---- theme/src/node/defaultOptions.ts | 7 ++++--- theme/src/node/resolveLocaleOptions.ts | 10 ++++++++++ theme/src/node/searchPluginOptions.ts | 12 +++++++----- theme/src/node/setupPages.ts | 6 +++--- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/plugins/plugin-notes-data/src/node/prepareNotesData.ts b/plugins/plugin-notes-data/src/node/prepareNotesData.ts index c68ce8f8..acf4e32c 100644 --- a/plugins/plugin-notes-data/src/node/prepareNotesData.ts +++ b/plugins/plugin-notes-data/src/node/prepareNotesData.ts @@ -83,7 +83,10 @@ export function watchNotesData(app: App, watchers: any[], options: NotesDataOpti if (!allOptions.length) return - const [firstLink, ...links] = allOptions.map(option => option.link) + const [firstLink, ...links] = allOptions.map(option => option.link).filter(Boolean) + + if (!firstLink) + return const dir = path.join('pages', firstLink, '**/*') const watcher = chokidar.watch(dir, { diff --git a/theme/src/client/components/Home.vue b/theme/src/client/components/Home.vue index be40bfc4..4198ae29 100644 --- a/theme/src/client/components/Home.vue +++ b/theme/src/client/components/Home.vue @@ -25,15 +25,15 @@ const homeStyle = computed(() => { mask.value ? `linear-gradient(rgba(0, 0, 0, ${mask.value}), rgba(0, 0, 0, ${mask.value}))` : '', - `url(${withBase(matter.value.banner || '')})`, + `url(${withBase(matter.value.banner ?? 'https://pengzhanbo.cn/images/home-banner.jpg')})`, ] .filter(Boolean) .join(','), } }) -const name = computed(() => matter.value.hero?.name) -const tagline = computed(() => matter.value.hero?.tagline) +const name = computed(() => matter.value.hero?.name ?? 'Plume') +const tagline = computed(() => matter.value.hero?.tagline ?? 'A VuePress Theme') const text = computed(() => matter.value.hero?.text) const actions = computed(() => { @@ -44,7 +44,7 @@ const actions = computed(() => {