vue3 监听vuex里的数据变化

时间:2025-02-16 11:43:13
import { computed, watch, } from 'vue'; const getShowTask = computed(()=>{ //返回的是ref对象 return store.state.监听的字段; }) watch(getShowTask, (newVal, oldVal) => { console.log('newVal, oldVal', newVal, oldVal) }, {immediate:true,deep:true});

相关文章