File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ var cid = 1
44
44
exports . extend = function ( extendOptions ) {
45
45
extendOptions = extendOptions || { }
46
46
var Super = this
47
+ var isFirstExtend = Super . cid === 0
48
+ if ( isFirstExtend && extendOptions . _Ctor ) {
49
+ return extendOptions . _Ctor
50
+ }
47
51
var name = extendOptions . name || Super . options . name
48
52
var Sub = createClass ( name || 'VueComponent' )
49
53
Sub . prototype = Object . create ( Super . prototype )
@@ -65,6 +69,10 @@ exports.extend = function (extendOptions) {
65
69
if ( name ) {
66
70
Sub . options . components [ name ] = Sub
67
71
}
72
+ // cache constructor
73
+ if ( isFirstExtend ) {
74
+ extendOptions . _Ctor = Sub
75
+ }
68
76
return Sub
69
77
}
70
78
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