File tree 2 files changed +9
-1
lines changed 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ var cid = 1
39
39
exports . extend = function ( extendOptions ) {
40
40
extendOptions = extendOptions || { }
41
41
var Super = this
42
+ var isFirstExtend = Super . cid === 0
43
+ if ( isFirstExtend && extendOptions . _Ctor ) {
44
+ return extendOptions . _Ctor
45
+ }
42
46
var name = extendOptions . name || Super . options . name
43
47
var Sub = createClass ( name || 'VueComponent' )
44
48
Sub . prototype = Object . create ( Super . prototype )
@@ -60,6 +64,10 @@ exports.extend = function (extendOptions) {
60
64
if ( name ) {
61
65
Sub . options . components [ name ] = Sub
62
66
}
67
+ // cache constructor
68
+ if ( isFirstExtend ) {
69
+ extendOptions . _Ctor = Sub
70
+ }
63
71
return Sub
64
72
}
65
73
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ function guardComponents (options) {
232
232
def = components [ key ]
233
233
if ( _ . isPlainObject ( def ) ) {
234
234
def . name = def . name || key
235
- components [ key ] = def . _Ctor || ( def . _Ctor = _ . Vue . extend ( def ) )
235
+ components [ key ] = _ . Vue . extend ( def )
236
236
}
237
237
}
238
238
}
You can’t perform that action at this time.
0 commit comments