File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ declare interface Component {
26
26
$children: Array < Component > ;
27
27
$refs: { [ key : string ] : Component | Element | Array < Component | Element > | void } ;
28
28
$slots: { [ key : string ] : Array < VNode > } ;
29
+ $vnode: VNode ;
29
30
$isServer: boolean ;
30
31
31
32
// public methods
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ export const renderState: {
17
17
}
18
18
19
19
export function initRender ( vm : Component ) {
20
- vm . _vnode = null
20
+ vm . $vnode = null // the placeholder node in parent tree
21
+ vm . _vnode = null // the root of the child tree
21
22
vm . _staticTrees = null
22
23
vm . $slots = { }
23
24
// bind the public createElement fn to this instance
@@ -50,7 +51,9 @@ export function renderMixin (Vue: Class<Component>) {
50
51
if ( staticRenderFns && ! this . _staticTrees ) {
51
52
this . _staticTrees = [ ]
52
53
}
53
-
54
+ // set parent vnode. this allows render functions to have access
55
+ // to the data on the placeholder node.
56
+ this . $vnode = _parentVnode
54
57
// resolve slots. becaues slots are rendered in parent scope,
55
58
// we set the activeInstance to parent.
56
59
if ( _renderChildren ) {
You can’t perform that action at this time.
0 commit comments