In Vue.js, both methods vs computed properties can return values for use in your templates, but they work differently behind the scenes. Computed properties are reactive and cached based on dependencies, while methods run every time they’re called.
Knowing when to use each helps you write efficient, performant components.
What Are Methods in Vue?
A method is just a function defined in the methods option (or inside using setup() or defineExpose). Methods run every time they’re called in the template or in your logic.
Example:
{{ greet() }}
function greet() {
return 'eSparkBiz!'
}