Skip to content

Commit 83b02ba

Browse files
committed
fix($core): failed to render <Content /> with dynamic pageKey from current $page.
1 parent 976c2b8 commit 83b02ba

File tree

1 file changed

+10
-1
lines changed
  • packages/@vuepress/core/lib/client/components

1 file changed

+10
-1
lines changed

packages/@vuepress/core/lib/client/components/Content.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { setGlobalInfo } from '@app/util'
1+
import Vue from 'vue'
2+
import { setGlobalInfo, getPageAsyncComponent } from '@app/util'
23

34
export default {
45
props: {
@@ -12,6 +13,14 @@ export default {
1213
const pageKey = this.pageKey || this.$parent.$page.key
1314
setGlobalInfo('pageKey', pageKey)
1415

16+
/**
17+
* This is for use cases that render `<Content />`
18+
* with dynamic pageKey from current $page.
19+
*/
20+
if (!Vue.component(pageKey)) {
21+
Vue.component(pageKey, getPageAsyncComponent(pageKey))
22+
}
23+
1524
if (pageKey) {
1625
return h(pageKey)
1726
}

0 commit comments

Comments
 (0)