@@ -26,6 +26,8 @@ module.exports = {
2626 // we simply remove it from the DOM and save it in a
2727 // cache object, with its constructor id as the key.
2828 this . keepAlive = this . _checkParam ( 'keep-alive' ) != null
29+ // wait for event before insertion
30+ this . readyEvent = this . _checkParam ( 'wait-for' )
2931 // check ref
3032 this . refID = _ . attr ( this . el , 'ref' )
3133 if ( this . keepAlive ) {
@@ -42,14 +44,9 @@ module.exports = {
4244 this . Ctor = null
4345 // if static, build right now.
4446 if ( ! this . _isDynamicLiteral ) {
45- this . resolveCtor ( this . expression , _ . bind ( function ( ) {
46- var child = this . build ( )
47- child . $before ( this . anchor )
48- this . setCurrent ( child )
49- } , this ) )
47+ this . resolveCtor ( this . expression , _ . bind ( this . initStatic , this ) )
5048 } else {
5149 // check dynamic component params
52- this . readyEvent = this . _checkParam ( 'wait-for' )
5350 this . transMode = this . _checkParam ( 'transition-mode' )
5451 }
5552 } else {
@@ -62,6 +59,23 @@ module.exports = {
6259 }
6360 } ,
6461
62+ /**
63+ * Initialize a static component.
64+ */
65+
66+ initStatic : function ( ) {
67+ var child = this . build ( )
68+ var anchor = this . anchor
69+ this . setCurrent ( child )
70+ if ( ! this . readyEvent ) {
71+ child . $before ( anchor )
72+ } else {
73+ child . $once ( this . readyEvent , function ( ) {
74+ child . $before ( anchor )
75+ } )
76+ }
77+ } ,
78+
6579 /**
6680 * Public update, called by the watcher in the dynamic
6781 * literal scenario, e.g. v-component="{{view}}"
0 commit comments