就是官方持久化用例
export function createApp() {
const app = createSSRApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
return {
app
}
};
export const useAppStore = defineStore('AppStore', {
persist: true,
state: () => {
return {
count: 0
}
},
getters: {
},
actions: {
increment() {
this.count++
},
},
})
3 个回复
DCloud_UNI_GSQ
我猜这个插件默认用的web storage,可能需要你自己配置一下,类似于这个:https://ext.dcloud.net.cn/plugin?id=280
7***@qq.com
有uni专用的掘金能搜到
2***@qq.com
解决没老哥,一样