computed — cached derived state. methods — functions that run on every call.
computed:
methods:
1// computed - cached2import { ref, computed } from "vue"34const count = ref(0)5const doubled = computed(() => {6 console.log("Computing...")7 return count.value * 28})9// Only logs when count changes
1// methods - no cache2function getDoubled() {3 console.log("Computing...")4 return count.value * 25}6// Logs every time called
Key differences: