|
|
@@ -8,7 +8,7 @@ import { initRender } from './render'
|
|
|
import { initEvents } from './events'
|
|
|
import { initInjections } from './inject'
|
|
|
import { initLifecycle, callHook } from './lifecycle'
|
|
|
-import { mergeOptions, formatComponentName } from '../util/index'
|
|
|
+import { extend, mergeOptions, formatComponentName } from '../util/index'
|
|
|
|
|
|
let uid = 0
|
|
|
|
|
|
@@ -88,14 +88,17 @@ export function resolveConstructorOptions (Ctor: Class<Component>) {
|
|
|
if (Ctor.super) {
|
|
|
const superOptions = Ctor.super.options
|
|
|
const cachedSuperOptions = Ctor.superOptions
|
|
|
- const extendOptions = Ctor.extendOptions
|
|
|
if (superOptions !== cachedSuperOptions) {
|
|
|
- // super option changed
|
|
|
+ // super option changed,
|
|
|
+ // need to resolve new options.
|
|
|
Ctor.superOptions = superOptions
|
|
|
- extendOptions.render = options.render
|
|
|
- extendOptions.staticRenderFns = options.staticRenderFns
|
|
|
- extendOptions._scopeId = options._scopeId
|
|
|
- options = Ctor.options = mergeOptions(superOptions, extendOptions)
|
|
|
+ // check if there are any late-modified/attached options (#4976)
|
|
|
+ const modifiedOptions = resolveModifiedOptions(Ctor)
|
|
|
+ // update base extend options
|
|
|
+ if (modifiedOptions) {
|
|
|
+ extend(Ctor.extendOptions, modifiedOptions)
|
|
|
+ }
|
|
|
+ options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions)
|
|
|
if (options.name) {
|
|
|
options.components[options.name] = Ctor
|
|
|
}
|
|
|
@@ -103,3 +106,16 @@ export function resolveConstructorOptions (Ctor: Class<Component>) {
|
|
|
}
|
|
|
return options
|
|
|
}
|
|
|
+
|
|
|
+function resolveModifiedOptions (Ctor: Class<Component>): ?Object {
|
|
|
+ let res
|
|
|
+ const options = Ctor.options
|
|
|
+ const sealed = Ctor.sealedOptions
|
|
|
+ for (const key in options) {
|
|
|
+ if (sealed[key] !== options[key]) {
|
|
|
+ if (!res) res = {}
|
|
|
+ res[key] = options[key]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res
|
|
|
+}
|