diff --git a/compiler/generate/index.js b/compiler/generate/index.js index fa9dc4f578..cc34ebee12 100644 --- a/compiler/generate/index.js +++ b/compiler/generate/index.js @@ -387,8 +387,8 @@ export default function generate ( parsed, source, options ) { if ( templateProperties.onrender ) { initStatements.push( deindent` - if ( options.parent ) { - options.parent.__renderHooks.push({ fn: template.onrender, context: this }); + if ( options.root ) { + options.root.__renderHooks.push({ fn: template.onrender, context: this }); } else { template.onrender.call( this ); } @@ -489,7 +489,7 @@ export default function generate ( parsed, source, options ) { state = {}; }; - this._parent = options.parent; + this.root = options.root; ${initStatements.join( '\n\n' )} } diff --git a/compiler/generate/visitors/Element.js b/compiler/generate/visitors/Element.js index 2b4e46acc0..c18bd545c8 100644 --- a/compiler/generate/visitors/Element.js +++ b/compiler/generate/visitors/Element.js @@ -58,7 +58,7 @@ export default { var ${name} = new template.components.${node.name}({ target: ${generator.current.target}, - parent: component._parent || component, + root: component.root || component, data: ${name}_initialData }); ` ); @@ -66,7 +66,7 @@ export default { local.init.unshift( deindent` var ${name} = new template.components.${node.name}({ target: ${generator.current.target}, - parent: component._parent || component + root: component.root || component }); ` ); }