@@ -37,6 +37,7 @@ export function renderElement (
37
37
// make sure to expose real self instead of proxy
38
38
const context : Component = this . _self
39
39
const parent : ?Component = renderState . activeInstance
40
+ const host = context !== parent ? parent : undefined
40
41
if ( ! parent ) {
41
42
process . env . NODE_ENV !== 'production' && warn (
42
43
'createElement cannot be called outside of component ' +
@@ -53,10 +54,10 @@ export function renderElement (
53
54
if ( config . isReservedTag ( tag ) ) {
54
55
return new VNode (
55
56
tag , data , undefined ,
56
- undefined , undefined , namespace , context
57
+ undefined , undefined , namespace , context , host
57
58
)
58
59
} else if ( ( Ctor = resolveAsset ( context . $options , 'components' , tag ) ) ) {
59
- return createComponent ( Ctor , data , parent , context , tag )
60
+ return createComponent ( Ctor , data , parent , context , host , tag )
60
61
} else {
61
62
if ( process . env . NODE_ENV !== 'production' ) {
62
63
if ( ! namespace && config . isUnknownElement ( tag ) ) {
@@ -69,11 +70,11 @@ export function renderElement (
69
70
}
70
71
return new VNode (
71
72
tag , data , undefined ,
72
- undefined , undefined , namespace , context
73
+ undefined , undefined , namespace , context , host
73
74
)
74
75
}
75
76
} else {
76
- return createComponent ( tag , data , parent , context )
77
+ return createComponent ( tag , data , parent , context , host )
77
78
}
78
79
}
79
80
@@ -82,5 +83,9 @@ export function renderText (str?: string): string {
82
83
}
83
84
84
85
export function renderStatic ( index ?: number ) : Object | void {
85
- return this . _staticTrees [ index ]
86
+ return this . _staticTrees [ index ] || (
87
+ this . _staticTrees [ index ] = this . $options . staticRenderFns [ index ] . call (
88
+ this . _renderProxy
89
+ )
90
+ )
86
91
}
0 commit comments