@@ -26,6 +26,8 @@ module.exports = {
26
26
// we simply remove it from the DOM and save it in a
27
27
// cache object, with its constructor id as the key.
28
28
this . keepAlive = this . _checkParam ( 'keep-alive' ) != null
29
+ // wait for event before insertion
30
+ this . readyEvent = this . _checkParam ( 'wait-for' )
29
31
// check ref
30
32
this . refID = _ . attr ( this . el , 'ref' )
31
33
if ( this . keepAlive ) {
@@ -42,14 +44,9 @@ module.exports = {
42
44
this . Ctor = null
43
45
// if static, build right now.
44
46
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 ) )
50
48
} else {
51
49
// check dynamic component params
52
- this . readyEvent = this . _checkParam ( 'wait-for' )
53
50
this . transMode = this . _checkParam ( 'transition-mode' )
54
51
}
55
52
} else {
@@ -62,6 +59,23 @@ module.exports = {
62
59
}
63
60
} ,
64
61
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
+
65
79
/**
66
80
* Public update, called by the watcher in the dynamic
67
81
* literal scenario, e.g. v-component="{{view}}"
0 commit comments