MCPcopy
hub / github.com/vuejs/core / applyOptions

Function applyOptions

packages/runtime-core/src/componentOptions.ts:520–792  ·  view source on GitHub ↗
(instance: ComponentInternalInstance)

Source from the content-addressed store, hash-verified

518export let shouldCacheAccess = true
519
520export function applyOptions(instance: ComponentInternalInstance): void {
521 const options = resolveMergedOptions(instance)
522 const publicThis = instance.proxy! as any
523 const ctx = instance.ctx
524
525 // do not cache property access on public proxy during state initialization
526 shouldCacheAccess = false
527
528 // call beforeCreate first before accessing other options since
529 // the hook may mutate resolved options (#2791)
530 if (options.beforeCreate) {
531 callHook(options.beforeCreate, instance, LifecycleHooks.BEFORE_CREATE)
532 }
533
534 const {
535 // state
536 data: dataOptions,
537 computed: computedOptions,
538 methods,
539 watch: watchOptions,
540 provide: provideOptions,
541 inject: injectOptions,
542 // lifecycle
543 created,
544 beforeMount,
545 mounted,
546 beforeUpdate,
547 updated,
548 activated,
549 deactivated,
550 beforeDestroy,
551 beforeUnmount,
552 destroyed,
553 unmounted,
554 render,
555 renderTracked,
556 renderTriggered,
557 errorCaptured,
558 serverPrefetch,
559 // public API
560 expose,
561 inheritAttrs,
562 // assets
563 components,
564 directives,
565 filters,
566 } = options
567
568 const checkDuplicateProperties = __DEV__ ? createDuplicateChecker() : null
569
570 if (__DEV__) {
571 const [propsOptions] = instance.propsOptions
572 if (propsOptions) {
573 for (const key in propsOptions) {
574 checkDuplicateProperties!(OptionTypes.PROPS, key)
575 }
576 }
577 }

Callers 1

finishComponentSetupFunction · 0.90

Calls 15

isFunctionFunction · 0.90
warnFunction · 0.90
isPromiseFunction · 0.90
isObjectFunction · 0.90
reactiveFunction · 0.90
isReservedPrefixFunction · 0.90
computedFunction · 0.90
provideFunction · 0.90
softAssertCompatEnabledFunction · 0.90
isCompatEnabledFunction · 0.90
markAsyncBoundaryFunction · 0.90
resolveMergedOptionsFunction · 0.85

Tested by

no test coverage detected