mergeOptions() — vue Function Reference
Architecture documentation for the mergeOptions() function in options.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e["mergeOptions()"] 5c734a8f_efba_819c_28fc_f56bfd6b701f["options.ts"] 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|defined in| 5c734a8f_efba_819c_28fc_f56bfd6b701f e326ac77_8ca1_bb32_d3f1_07fd7421ceda["checkComponents()"] 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|calls| e326ac77_8ca1_bb32_d3f1_07fd7421ceda 90973dca_1240_2e26_1a4a_ded8b0574117["normalizeProps()"] 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|calls| 90973dca_1240_2e26_1a4a_ded8b0574117 110512ab_6565_25cb_454b_0398b25624f9["normalizeInject()"] 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|calls| 110512ab_6565_25cb_454b_0398b25624f9 5686bad4_36ee_1774_e271_49728cecc365["normalizeDirectives()"] 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e -->|calls| 5686bad4_36ee_1774_e271_49728cecc365 style 74488b2b_ad6c_b2c0_5bac_8703e8f1b25e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/util/options.ts lines 411–459
export function mergeOptions(
parent: Record<string, any>,
child: Record<string, any>,
vm?: Component | null
): ComponentOptions {
if (__DEV__) {
checkComponents(child)
}
if (isFunction(child)) {
// @ts-expect-error
child = child.options
}
normalizeProps(child, vm)
normalizeInject(child, vm)
normalizeDirectives(child)
// Apply extends and mixins on the child options,
// but only if it is a raw options object that isn't
// the result of another mergeOptions call.
// Only merged options has the _base property.
if (!child._base) {
if (child.extends) {
parent = mergeOptions(parent, child.extends, vm)
}
if (child.mixins) {
for (let i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm)
}
}
}
const options: ComponentOptions = {} as any
let key
for (key in parent) {
mergeField(key)
}
for (key in child) {
if (!hasOwn(parent, key)) {
mergeField(key)
}
}
function mergeField(key: any) {
const strat = strats[key] || defaultStrat
options[key] = strat(parent[key], child[key], vm, key)
}
return options
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does mergeOptions() do?
mergeOptions() is a function in the vue codebase, defined in src/core/util/options.ts.
Where is mergeOptions() defined?
mergeOptions() is defined in src/core/util/options.ts at line 411.
What does mergeOptions() call?
mergeOptions() calls 4 function(s): checkComponents, normalizeDirectives, normalizeInject, normalizeProps.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free