直接引入
import {
ref, watch, computed } from 'vue';
- computed
const light = computed(() => lightOri.value + 2);
- watch
watch(lightOri, (newVal, oldVal) => {
console.log('watch');
},
{
immediate: true
}
)