From 2ac78bda6299639b8bd15935decc884335d53e02 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Thu, 14 Sep 2023 10:17:46 +0800 Subject: [PATCH] chore: fix type error --- packages/client/src/router.ts | 2 +- packages/client/src/setupGlobalComputed.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts index d6045df4e7..b9c6596d01 100644 --- a/packages/client/src/router.ts +++ b/packages/client/src/router.ts @@ -53,6 +53,6 @@ declare module 'vue-router' { * * @internal only for internal use */ - _data: PageData + _data?: PageData } } diff --git a/packages/client/src/setupGlobalComputed.ts b/packages/client/src/setupGlobalComputed.ts index 49c4fa6901..4f914337d2 100644 --- a/packages/client/src/setupGlobalComputed.ts +++ b/packages/client/src/setupGlobalComputed.ts @@ -73,13 +73,13 @@ export const setupGlobalComputed = ( // load page data from route meta const pageData = computedWithControl( routePath, - () => router.currentRoute.value.meta._data, + () => router.currentRoute.value.meta._data!, ) // handle page data HMR if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) { __VUE_HMR_RUNTIME__.updatePageData = (data: PageData) => { pagesData.value[data.key] = () => Promise.resolve(data) - if (data.key === router.currentRoute.value.meta._data.key) { + if (data.key === router.currentRoute.value.meta._data?.key) { router.currentRoute.value.meta._data = data pageData.trigger() }