From 3e91eba5beed4e94367ae6b993b02b3bb89976ae Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Sun, 10 Mar 2019 06:01:24 +0800 Subject: [PATCH] fix($core): PascalCase layouts cannot be used with camelCase nor hyphen-delimited (close: #1391) --- .../core/lib/client/components/Content.js | 7 +- .../lib/client/components/GlobalLayout.vue | 11 +-- .../core/lib/client/plugins/VuePress.js | 16 ++-- packages/@vuepress/core/lib/client/util.js | 83 +++++++++++++++---- packages/docs/docs/theme/option-api.md | 3 +- packages/docs/docs/zh/theme/option-api.md | 3 +- 6 files changed, 86 insertions(+), 37 deletions(-) diff --git a/packages/@vuepress/core/lib/client/components/Content.js b/packages/@vuepress/core/lib/client/components/Content.js index c0ffc38af2..12d7096810 100644 --- a/packages/@vuepress/core/lib/client/components/Content.js +++ b/packages/@vuepress/core/lib/client/components/Content.js @@ -1,5 +1,5 @@ import Vue from 'vue' -import { isPageExists, getPageAsyncComponent } from '../util' +import { getPageAsyncComponent } from '../util' export default { props: { @@ -11,8 +11,9 @@ export default { }, render (h) { const pageKey = this.pageKey || this.$parent.$page.key - if (isPageExists(pageKey)) { - Vue.component(pageKey, getPageAsyncComponent(pageKey)) + const pageComponent = getPageAsyncComponent(pageKey) + if (pageComponent) { + Vue.component(pageKey, pageComponent) return h(pageKey) } return h('') diff --git a/packages/@vuepress/core/lib/client/components/GlobalLayout.vue b/packages/@vuepress/core/lib/client/components/GlobalLayout.vue index deced74e20..077c65a59b 100644 --- a/packages/@vuepress/core/lib/client/components/GlobalLayout.vue +++ b/packages/@vuepress/core/lib/client/components/GlobalLayout.vue @@ -3,17 +3,14 @@