watch(() => aa.value, (newValue) => { console.log(newValue) useDebounceFn(() => { console.log(newValue) }, 500) }) 如上面那样,无法监听到 实际项目中 const state = useState('resUmeValue',()=>useResumeList()) if(process.client && localStorage){ watch(()=>state.value,(newValue...
设置:我正在使用Nuxt3 + Pinia + VueUse。 目标: 我想通过VueUse中的useStorage将Pinia存储库的状态保存到本地存储中。 问题: 由于某种原因,在本地存储中没有创建任何项。我觉得我在这里缺少了什么。在组件中,我可以很好地使用useStorage。 在stores/piniaStoreVueUse.js中 import { defineStore } from 'pinia...
Vue 插件和 Nuxt 插件之间存在一些差异。您想要做的是创建一个 Nuxt 插件来使用 Vue 组件。因此,为了做到这一点,您需要将代码更新为: import { VueDraggableNext } from "vue-draggable-next"; export default defineNuxtPlugin((nuxtApp) => { nuxtApp.vueApp.component("draggable", VueDraggableNext); });...
let handleFn = useDebounceFn(()=>{ console.log(newValue) localStorage.setItem('resUme',JSON.stringify(newValue)) },500) watch(()=>state.value,(newValue)=>{ handleFn(newValue) },{deep:true}) // 或者直接 watch(()=>state.value,handleFn,{deep:true}) 有用 回复 查看全部 3 个回答 ...