computed — cached, reactive. methods — executed on each call.
computed:
1import { ref, computed } from "vue"23const count = ref(0)4const doubled = computed(() => count.value * 2)5// Only recalculates when count changes
methods:
1function increment() {2 count.value++3}45function getDoubled() {6 return count.value * 2 // Calculates each time7}
Key differences: