getPropDefaultValue() — vue Function Reference
Architecture documentation for the getPropDefaultValue() function in props.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD f17df5f9_8c05_1fd0_9b66_82a82a8be567["getPropDefaultValue()"] d99d7982_2691_1c11_3bae_459f2d25122d["validateProp()"] d99d7982_2691_1c11_3bae_459f2d25122d -->|calls| f17df5f9_8c05_1fd0_9b66_82a82a8be567 f2fe9306_50d5_675e_2dfa_2c4d78443a49["hasOwn()"] f17df5f9_8c05_1fd0_9b66_82a82a8be567 -->|calls| f2fe9306_50d5_675e_2dfa_2c4d78443a49 2d184c1f_e247_ef28_44f9_122886cfd2a5["isObject()"] f17df5f9_8c05_1fd0_9b66_82a82a8be567 -->|calls| 2d184c1f_e247_ef28_44f9_122886cfd2a5 e3484a9f_f8a5_4082_0208_641d58b965c3["warn()"] f17df5f9_8c05_1fd0_9b66_82a82a8be567 -->|calls| e3484a9f_f8a5_4082_0208_641d58b965c3 5af21a52_5316_e857_22eb_dce69bb60268["isFunction()"] f17df5f9_8c05_1fd0_9b66_82a82a8be567 -->|calls| 5af21a52_5316_e857_22eb_dce69bb60268 fbb240de_965a_91cc_941c_3973c9ae84a4["getType()"] f17df5f9_8c05_1fd0_9b66_82a82a8be567 -->|calls| fbb240de_965a_91cc_941c_3973c9ae84a4 style f17df5f9_8c05_1fd0_9b66_82a82a8be567 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
Called By
Source
Frequently Asked Questions
What does getPropDefaultValue() do?
getPropDefaultValue() is a function in the vue codebase.
What does getPropDefaultValue() call?
getPropDefaultValue() calls 5 function(s): getType, hasOwn, isFunction, isObject, 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