Vue’s computed and watch use

Hits: 0

direct import

import { ref, watch, computed } from 'vue';

  • computed

const light = computed(() => lightOri.value + 2);

  • watch

watch(lightOri, (newVal, oldVal) => {  
        console.log('watch');
    },
    {
        immediate: true
    }
    )

You may also like...

Leave a Reply

Your email address will not be published.