vue3 监听vuex里的数据变化
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});