vue3 监听vuex里的数据变化 初竹殇 2023-02-22 1,133 阅读1分钟 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});