对 vuex 或 Pinia 里面的内容做本地持久化
1. 安装插件: npm i pinia-plugin-persistedstate
2. 将插件添加到 pinia 实例上
① main.js 里导入持久化插件:import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
② app.use(pinia.use(piniaPluginPersistedstate))
3. .js 文件里,第三个参数的位置:
export const useChannelStore = defineStore('channel', () => { }, { piniaPluginPersistedstate: true }) 标签:插件,持久,Pinia,use,pinia,Vue3,piniaPluginPersistedstate From: https://www.cnblogs.com/gagaya2/p/17764626.html