|
@@ -216,10 +216,6 @@ export function applyOptions(
|
|
|
options: ComponentOptions,
|
|
options: ComponentOptions,
|
|
|
asMixin: boolean = false
|
|
asMixin: boolean = false
|
|
|
) {
|
|
) {
|
|
|
- const renderContext =
|
|
|
|
|
- instance.renderContext === EMPTY_OBJ
|
|
|
|
|
- ? (instance.renderContext = __SSR__ ? {} : reactive({}))
|
|
|
|
|
- : instance.renderContext
|
|
|
|
|
const ctx = instance.proxy!
|
|
const ctx = instance.proxy!
|
|
|
const {
|
|
const {
|
|
|
// composition
|
|
// composition
|
|
@@ -250,6 +246,11 @@ export function applyOptions(
|
|
|
errorCaptured
|
|
errorCaptured
|
|
|
} = options
|
|
} = options
|
|
|
|
|
|
|
|
|
|
+ const renderContext =
|
|
|
|
|
+ instance.renderContext === EMPTY_OBJ
|
|
|
|
|
+ ? (instance.renderContext = {})
|
|
|
|
|
+ : instance.renderContext
|
|
|
|
|
+
|
|
|
const globalMixins = instance.appContext.mixins
|
|
const globalMixins = instance.appContext.mixins
|
|
|
// call it only during dev
|
|
// call it only during dev
|
|
|
const checkDuplicateProperties = __DEV__ ? createDuplicateChecker() : null
|
|
const checkDuplicateProperties = __DEV__ ? createDuplicateChecker() : null
|
|
@@ -285,12 +286,13 @@ export function applyOptions(
|
|
|
checkDuplicateProperties!(OptionTypes.DATA, key)
|
|
checkDuplicateProperties!(OptionTypes.DATA, key)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- instance.data = __SSR__ ? data : reactive(data)
|
|
|
|
|
|
|
+ instance.data = reactive(data)
|
|
|
} else {
|
|
} else {
|
|
|
// existing data: this is a mixin or extends.
|
|
// existing data: this is a mixin or extends.
|
|
|
extend(instance.data, data)
|
|
extend(instance.data, data)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (computedOptions) {
|
|
if (computedOptions) {
|
|
|
for (const key in computedOptions) {
|
|
for (const key in computedOptions) {
|
|
|
const opt = (computedOptions as ComputedOptions)[key]
|
|
const opt = (computedOptions as ComputedOptions)[key]
|
|
@@ -335,11 +337,13 @@ export function applyOptions(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (watchOptions) {
|
|
if (watchOptions) {
|
|
|
for (const key in watchOptions) {
|
|
for (const key in watchOptions) {
|
|
|
createWatcher(watchOptions[key], renderContext, ctx, key)
|
|
createWatcher(watchOptions[key], renderContext, ctx, key)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (provideOptions) {
|
|
if (provideOptions) {
|
|
|
const provides = isFunction(provideOptions)
|
|
const provides = isFunction(provideOptions)
|
|
|
? provideOptions.call(ctx)
|
|
? provideOptions.call(ctx)
|
|
@@ -348,6 +352,7 @@ export function applyOptions(
|
|
|
provide(key, provides[key])
|
|
provide(key, provides[key])
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (injectOptions) {
|
|
if (injectOptions) {
|
|
|
if (isArray(injectOptions)) {
|
|
if (isArray(injectOptions)) {
|
|
|
for (let i = 0; i < injectOptions.length; i++) {
|
|
for (let i = 0; i < injectOptions.length; i++) {
|