initMethods() — vue Function Reference
Architecture documentation for the initMethods() function in state.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD b08d62fe_27b2_1190_5fbe_74fd290a4ff5["initMethods()"] 079339bc_f0ce_0fd0_3d1b_26a2dc073616["state.ts"] b08d62fe_27b2_1190_5fbe_74fd290a4ff5 -->|defined in| 079339bc_f0ce_0fd0_3d1b_26a2dc073616 ff5d1d58_05a4_1c98_682b_8814ac1fe9fd["initState()"] ff5d1d58_05a4_1c98_682b_8814ac1fe9fd -->|calls| b08d62fe_27b2_1190_5fbe_74fd290a4ff5 style b08d62fe_27b2_1190_5fbe_74fd290a4ff5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/state.ts lines 285–310
function initMethods(vm: Component, methods: Object) {
const props = vm.$options.props
for (const key in methods) {
if (__DEV__) {
if (typeof methods[key] !== 'function') {
warn(
`Method "${key}" has type "${typeof methods[
key
]}" in the component definition. ` +
`Did you reference the function correctly?`,
vm
)
}
if (props && hasOwn(props, key)) {
warn(`Method "${key}" has already been defined as a prop.`, vm)
}
if (key in vm && isReserved(key)) {
warn(
`Method "${key}" conflicts with an existing Vue instance method. ` +
`Avoid defining component methods that start with _ or $.`
)
}
}
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm)
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does initMethods() do?
initMethods() is a function in the vue codebase, defined in src/core/instance/state.ts.
Where is initMethods() defined?
initMethods() is defined in src/core/instance/state.ts at line 285.
What calls initMethods()?
initMethods() is called by 1 function(s): initState.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free