initComputed() — vue Function Reference
Architecture documentation for the initComputed() function in state.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 7b0a7d03_cfef_5efb_b868_2bd41b0196d7["initComputed()"] 910d3a96_5984_cf85_40a3_47933bd75818["state.ts"] 7b0a7d03_cfef_5efb_b868_2bd41b0196d7 -->|defined in| 910d3a96_5984_cf85_40a3_47933bd75818 bbde495f_48f3_a910_410f_28718d2c8ee1["initComputed()"] bbde495f_48f3_a910_410f_28718d2c8ee1 -->|calls| 7b0a7d03_cfef_5efb_b868_2bd41b0196d7 ceeb400a_fb7f_c638_1feb_8311db20c105["initState()"] ceeb400a_fb7f_c638_1feb_8311db20c105 -->|calls| 7b0a7d03_cfef_5efb_b868_2bd41b0196d7 d78d0fa2_2aba_d914_c67d_4cb1b5a75d62["defineComputed()"] 7b0a7d03_cfef_5efb_b868_2bd41b0196d7 -->|calls| d78d0fa2_2aba_d914_c67d_4cb1b5a75d62 style 7b0a7d03_cfef_5efb_b868_2bd41b0196d7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/state.ts lines 183–224
function initComputed(vm: Component, computed: Object) {
// $flow-disable-line
const watchers = (vm._computedWatchers = Object.create(null))
// computed properties are just getters during SSR
const isSSR = isServerRendering()
for (const key in computed) {
const userDef = computed[key]
const getter = isFunction(userDef) ? userDef : userDef.get
if (__DEV__ && getter == null) {
warn(`Getter is missing for computed property "${key}".`, vm)
}
if (!isSSR) {
// create internal watcher for the computed property.
watchers[key] = new Watcher(
vm,
getter || noop,
noop,
computedWatcherOptions
)
}
// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
// at instantiation here.
if (!(key in vm)) {
defineComputed(vm, key, userDef)
} else if (__DEV__) {
if (key in vm.$data) {
warn(`The computed property "${key}" is already defined in data.`, vm)
} else if (vm.$options.props && key in vm.$options.props) {
warn(`The computed property "${key}" is already defined as a prop.`, vm)
} else if (vm.$options.methods && key in vm.$options.methods) {
warn(
`The computed property "${key}" is already defined as a method.`,
vm
)
}
}
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does initComputed() do?
initComputed() is a function in the vue codebase, defined in src/core/instance/state.ts.
Where is initComputed() defined?
initComputed() is defined in src/core/instance/state.ts at line 183.
What does initComputed() call?
initComputed() calls 1 function(s): defineComputed.
What calls initComputed()?
initComputed() is called by 2 function(s): initComputed, initState.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free