@@ -24,7 +24,7 @@ export function initMixin (Vue: Class<Component>) {
2424 initInternalComponent ( vm , options )
2525 } else {
2626 vm . $options = mergeOptions (
27- resolveConstructorOptions ( vm ) ,
27+ resolveConstructorOptions ( vm . constructor ) ,
2828 options || { } ,
2929 vm
3030 )
@@ -44,37 +44,36 @@ export function initMixin (Vue: Class<Component>) {
4444 callHook ( vm , 'created' )
4545 initRender ( vm )
4646 }
47+ }
4748
48- function initInternalComponent ( vm : Component , options : InternalComponentOptions ) {
49- const opts = vm . $options = Object . create ( resolveConstructorOptions ( vm ) )
50- // doing this because it's faster than dynamic enumeration.
51- opts . parent = options . parent
52- opts . propsData = options . propsData
53- opts . _parentVnode = options . _parentVnode
54- opts . _parentListeners = options . _parentListeners
55- opts . _renderChildren = options . _renderChildren
56- opts . _componentTag = options . _componentTag
57- if ( options . render ) {
58- opts . render = options . render
59- opts . staticRenderFns = options . staticRenderFns
60- }
49+ function initInternalComponent ( vm : Component , options : InternalComponentOptions ) {
50+ const opts = vm . $options = Object . create ( vm . constructor . options )
51+ // doing this because it's faster than dynamic enumeration.
52+ opts . parent = options . parent
53+ opts . propsData = options . propsData
54+ opts . _parentVnode = options . _parentVnode
55+ opts . _parentListeners = options . _parentListeners
56+ opts . _renderChildren = options . _renderChildren
57+ opts . _componentTag = options . _componentTag
58+ if ( options . render ) {
59+ opts . render = options . render
60+ opts . staticRenderFns = options . staticRenderFns
6161 }
62+ }
6263
63- function resolveConstructorOptions ( vm : Component ) {
64- const Ctor = vm . constructor
65- let options = Ctor . options
66- if ( Ctor . super ) {
67- const superOptions = Ctor . super . options
68- const cachedSuperOptions = Ctor . superOptions
69- if ( superOptions !== cachedSuperOptions ) {
70- // super option changed
71- Ctor . superOptions = superOptions
72- options = Ctor . options = mergeOptions ( superOptions , Ctor . extendOptions )
73- if ( options . name ) {
74- options . components [ options . name ] = Ctor
75- }
64+ export function resolveConstructorOptions ( Ctor : Class < Component > ) {
65+ let options = Ctor . options
66+ if ( Ctor . super ) {
67+ const superOptions = Ctor . super . options
68+ const cachedSuperOptions = Ctor . superOptions
69+ if ( superOptions !== cachedSuperOptions ) {
70+ // super option changed
71+ Ctor . superOptions = superOptions
72+ options = Ctor . options = mergeOptions ( superOptions , Ctor . extendOptions )
73+ if ( options . name ) {
74+ options . components [ options . name ] = Ctor
7675 }
7776 }
78- return options
7977 }
78+ return options
8079}
0 commit comments