@@ -96,8 +96,7 @@ module.exports = {
9696 }
9797 }
9898 }
99- var child = this . build ( options )
100- this . setCurrent ( child )
99+ var child = this . childVM = this . build ( options )
101100 if ( ! this . waitForEvent ) {
102101 if ( activateHook ) {
103102 activateHook . call ( child , insert )
@@ -142,7 +141,7 @@ module.exports = {
142141 // just remove current
143142 this . unbuild ( true )
144143 this . remove ( this . childVM , cb )
145- this . unsetCurrent ( )
144+ this . childVM = null
146145 } else {
147146 this . resolveComponent ( value , _ . bind ( function ( ) {
148147 this . unbuild ( true )
@@ -227,6 +226,7 @@ module.exports = {
227226 // if no inline-template, then the compiled
228227 // linker can be cached for better performance.
229228 _linkerCachable : ! this . inlineTemplate ,
229+ _ref : this . ref ,
230230 _asComponent : true ,
231231 _isRouterView : this . _isRouterView ,
232232 // if this is a transcluded component, context
@@ -339,7 +339,7 @@ module.exports = {
339339 transition : function ( target , cb ) {
340340 var self = this
341341 var current = this . childVM
342- this . setCurrent ( target )
342+ this . childVM = target
343343 switch ( self . transMode ) {
344344 case 'in-out' :
345345 target . $before ( self . anchor , function ( ) {
@@ -357,32 +357,6 @@ module.exports = {
357357 }
358358 } ,
359359
360- /**
361- * Set childVM and parent ref
362- */
363-
364- setCurrent : function ( child ) {
365- this . unsetCurrent ( )
366- this . childVM = child
367- var ref = child . _refId || this . ref
368- if ( ref ) {
369- ( this . _scope || this . vm ) . $ [ ref ] = child
370- }
371- } ,
372-
373- /**
374- * Unset childVM and parent ref
375- */
376-
377- unsetCurrent : function ( ) {
378- var child = this . childVM
379- this . childVM = null
380- var ref = ( child && child . _refId ) || this . ref
381- if ( ref ) {
382- ( this . _scope || this . vm ) . $ [ ref ] = null
383- }
384- } ,
385-
386360 /**
387361 * Unbind.
388362 */
@@ -391,7 +365,6 @@ module.exports = {
391365 this . invalidatePending ( )
392366 // Do not defer cleanup when unbinding
393367 this . unbuild ( )
394- this . unsetCurrent ( )
395368 // destroy all keep-alive cached instances
396369 if ( this . cache ) {
397370 for ( var key in this . cache ) {
0 commit comments