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 {
2626 $children: Array < Component > ;
2727 $refs: { [ key : string ] : Component | Element | Array < Component | Element > | void } ;
2828 $slots: { [ key : string ] : Array < VNode > } ;
29+ $vnode: VNode ;
2930 $isServer: boolean ;
3031
3132 // public methods
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ export const renderState: {
1717}
1818
1919export 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
2122 vm . _staticTrees = null
2223 vm . $slots = { }
2324 // bind the public createElement fn to this instance
@@ -50,7 +51,9 @@ export function renderMixin (Vue: Class<Component>) {
5051 if ( staticRenderFns && ! this . _staticTrees ) {
5152 this . _staticTrees = [ ]
5253 }
53-
54+ // set parent vnode. this allows render functions to have access
55+ // to the data on the placeholder node.
56+ this . $vnode = _parentVnode
5457 // resolve slots. becaues slots are rendered in parent scope,
5558 // we set the activeInstance to parent.
5659 if ( _renderChildren ) {
You can’t perform that action at this time.
0 commit comments