From 0d2c98d3390e0b1504b1646495946423afdb9706 Mon Sep 17 00:00:00 2001 From: zthxxx Date: Tue, 16 Jul 2019 20:06:58 +0800 Subject: [PATCH] fix: fix 'Unknown custom element' without any content **Bug**: example, use `` in a custom page without markdown, will raise `[Vue warn]: Unknown custom element`, like #1173 #1426 **Reason**: because it not inject any content in `@internal/page-components` while not find markdown file, `Vue.component` of `pageKey` must be `undefined`, then `h(pageKey)` raise this error **Fix**: judge as `if (Vue.component(pageKey))`, unnecessary to render if no component existed --- packages/@vuepress/core/lib/client/components/Content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vuepress/core/lib/client/components/Content.js b/packages/@vuepress/core/lib/client/components/Content.js index 4e514de508..ce03278968 100644 --- a/packages/@vuepress/core/lib/client/components/Content.js +++ b/packages/@vuepress/core/lib/client/components/Content.js @@ -21,7 +21,7 @@ export default { Vue.component(pageKey, getPageAsyncComponent(pageKey)) } - if (pageKey) { + if (Vue.component(pageKey)) { return h(pageKey) } return h('')