ਇੱਕ ਕੰਪਿਊਟਡ ਪ੍ਰਾਪਰਟੀ ਦੂਸਰੀ reactive ਸਥਿਤੀ ਤੋਂ ਪ੍ਰਾਪਤ ਇੱਕ reactive ਮੁੱਲ ਹੈ। ਇਹ ਆਪਣੀ ਨਿਰਭਰਤਾ ਬਦਲਣ ਨਾਲ ਸਵੈਚਾਲਤ ਤੌਰ 'ਤੇ ਦੁਬਾਰਾ ਗਿਣਤੀ ਕਰਦਾ ਹੈ, ਅਤੇ — ਮਹੱਤਵਪੂਰਨ ਗੱਲ — ਆਪਣੇ ਨਤੀਜੇ ਨੂੰ ਕੈਸ਼ ਕਰਦਾ ਹੈ ਤਾਂਜੋ ਇਹ ਸਿਰਫ ਤਦ ਚਲਦਾ ਹੈ ਜਦੋਂ ਕੋਈ ਚੀਜ਼ ਜਿਸ 'ਤੇ ਇਹ ਨਿਰਭਰ ਹੈ ਅਸਲ ਵਿੱਚ ਬਦਲਦੀ ਹੈ।
<script setup>
import { ref, computed } from "vue";
const firstName = ref("Ann");
const lastName = ref("Lee");
const fullName = computed(() => `${firstName.value} ${lastName.value}`);
// fullName updates automatically whenever firstName OR lastName changes
</script>
<template>
<p>{{ fullName }}</p> <!-- auto-unwrapped, like a ref -->
</template>
