initMethods() — vue Function Reference
Architecture documentation for the initMethods() function in state.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 4bf2207f_69b6_5c56_a089_3fc806d31345["initMethods()"] a45b86d7_95dc_3c82_51a7_1bc8c4d23289["initState()"] a45b86d7_95dc_3c82_51a7_1bc8c4d23289 -->|calls| 4bf2207f_69b6_5c56_a089_3fc806d31345 style 4bf2207f_69b6_5c56_a089_3fc806d31345 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
Called By
Source
Frequently Asked Questions
What does initMethods() do?
initMethods() is a function in the vue codebase.
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