Skip to content

Commit

Permalink
fix($core): failed to render <Content /> with dynamic pageKey from …
Browse files Browse the repository at this point in the history
…current $page.
  • Loading branch information
ulivz committed Jun 5, 2019
1 parent 976c2b8 commit 83b02ba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/@vuepress/core/lib/client/components/Content.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { setGlobalInfo } from '@app/util'
import Vue from 'vue'
import { setGlobalInfo, getPageAsyncComponent } from '@app/util'

export default {
props: {
Expand All @@ -12,6 +13,14 @@ export default {
const pageKey = this.pageKey || this.$parent.$page.key
setGlobalInfo('pageKey', pageKey)

/**
* This is for use cases that render `<Content />`
* with dynamic pageKey from current $page.
*/
if (!Vue.component(pageKey)) {
Vue.component(pageKey, getPageAsyncComponent(pageKey))
}

if (pageKey) {
return h(pageKey)
}
Expand Down

0 comments on commit 83b02ba

Please sign in to comment.