Skip to content

Commit

Permalink
fix($core): '[Vue warn]: Unknown custom element' when using `<Content…
Browse files Browse the repository at this point in the history
… />` in a custom page without markdown (#1699)

**Bug**: example, , 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
  • Loading branch information
zthxxx authored and ulivz committed Jul 20, 2019
1 parent 984a1a8 commit 2a59800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/client/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
Vue.component(pageKey, getPageAsyncComponent(pageKey))
}

if (pageKey) {
if (Vue.component(pageKey)) {
return h(pageKey)
}
return h('')
Expand Down

0 comments on commit 2a59800

Please sign in to comment.