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
4444exports . extend = function ( extendOptions ) {
4545 extendOptions = extendOptions || { }
4646 var Super = this
47+ var isFirstExtend = Super . cid === 0
48+ if ( isFirstExtend && extendOptions . _Ctor ) {
49+ return extendOptions . _Ctor
50+ }
4751 var name = extendOptions . name || Super . options . name
4852 var Sub = createClass ( name || 'VueComponent' )
4953 Sub . prototype = Object . create ( Super . prototype )
@@ -65,6 +69,10 @@ exports.extend = function (extendOptions) {
6569 if ( name ) {
6670 Sub . options . components [ name ] = Sub
6771 }
72+ // cache constructor
73+ if ( isFirstExtend ) {
74+ extendOptions . _Ctor = Sub
75+ }
6876 return Sub
6977}
7078
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ function guardComponents (options) {
232232 def = components [ key ]
233233 if ( _ . isPlainObject ( def ) ) {
234234 def . name = def . name || key
235- components [ key ] = def . _Ctor || ( def . _Ctor = _ . Vue . extend ( def ) )
235+ components [ key ] = _ . Vue . extend ( def )
236236 }
237237 }
238238 }
You can’t perform that action at this time.
0 commit comments