feat(runtime-core): support config.optionMergeStrategies

Note the behavior is different from Vue 2:
- merge strategies no longer apply to built-in options.
- the default value is now an empty object and no longer exposes merge
  strategies for built-in options.
This commit is contained in:
Evan You
2020-03-24 11:59:00 -04:00
parent 123738727a
commit 528621ba41
5 changed files with 82 additions and 11 deletions

View File

@@ -6,7 +6,8 @@ import {
ExtractComputedReturns,
ComponentOptionsBase,
ComputedOptions,
MethodOptions
MethodOptions,
resolveMergedOptions
} from './apiOptions'
import { ReactiveEffect, UnwrapRef } from '@vue/reactivity'
import { warn } from './warning'
@@ -61,7 +62,7 @@ const publicPropertiesMap: Record<
$parent: i => i.parent,
$root: i => i.root,
$emit: i => i.emit,
$options: i => i.type,
$options: i => (__FEATURE_OPTIONS__ ? resolveMergedOptions(i) : i.type),
$forceUpdate: i => () => queueJob(i.update),
$nextTick: () => nextTick,
$watch: __FEATURE_OPTIONS__ ? i => instanceWatch.bind(i) : NOOP