getPropDefaultValue() — vue Function Reference
Architecture documentation for the getPropDefaultValue() function in props.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 74686ece_4514_c481_91bf_a291bc504ca2["getPropDefaultValue()"] ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc["props.ts"] 74686ece_4514_c481_91bf_a291bc504ca2 -->|defined in| ebb0510e_1beb_0f1e_d9b5_9f9e319cefcc 7425417e_e38e_e5e8_6678_47ee9b0e04c2["validateProp()"] 7425417e_e38e_e5e8_6678_47ee9b0e04c2 -->|calls| 74686ece_4514_c481_91bf_a291bc504ca2 48bc61b1_05ca_3121_50a7_2f02cdcf2f03["warn()"] 74686ece_4514_c481_91bf_a291bc504ca2 -->|calls| 48bc61b1_05ca_3121_50a7_2f02cdcf2f03 089784d1_bec2_cac1_11c8_a234cf70796b["getType()"] 74686ece_4514_c481_91bf_a291bc504ca2 -->|calls| 089784d1_bec2_cac1_11c8_a234cf70796b style 74686ece_4514_c481_91bf_a291bc504ca2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/util/props.ts lines 64–100
function getPropDefaultValue(
vm: Component | undefined,
prop: PropOptions,
key: string
): any {
// no default, return undefined
if (!hasOwn(prop, 'default')) {
return undefined
}
const def = prop.default
// warn against non-factory defaults for Object & Array
if (__DEV__ && isObject(def)) {
warn(
'Invalid default value for prop "' +
key +
'": ' +
'Props with type Object/Array must use a factory function ' +
'to return the default value.',
vm
)
}
// the raw prop value was also undefined from previous render,
// return previous default value to avoid unnecessary watcher trigger
if (
vm &&
vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined
) {
return vm._props[key]
}
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return isFunction(def) && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getPropDefaultValue() do?
getPropDefaultValue() is a function in the vue codebase, defined in src/core/util/props.ts.
Where is getPropDefaultValue() defined?
getPropDefaultValue() is defined in src/core/util/props.ts at line 64.
What does getPropDefaultValue() call?
getPropDefaultValue() calls 2 function(s): getType, warn.
What calls getPropDefaultValue()?
getPropDefaultValue() is called by 1 function(s): validateProp.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free