[Vuejs]-Vue Computed Not Updating

0👍

You should add a setter to your computed property with a getter :


<input v-model="policyMapName" />
policy-map <span>{{ policyMapName }}</span>

setup() {
    const circuitID = ref('99/KRFS/010572//SYG');

    const policyMapName = computed({
      get: () => {
        const cID = circuitID.value;

        return cID.replace(/[/]/g, '').slice(0, -3);
     },
    set:(newval)=>{
        circuitID.value =newval
    }   
 });
}

Leave a comment