From e783d1416430feb3a4a418cf30846ebdbd1994ab Mon Sep 17 00:00:00 2001 From: liruiqiang <3151805288@qq.com> Date: Sat, 9 Aug 2025 15:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF=20Pinia=20?= =?UTF-8?q?=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 2 +- package.json | 2 +- src/stores/modules/member.ts | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2544b39..a76ad04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3081220230802001", "@dcloudio/uni-ui": "^1.5.10", "pinia": "2.0.27", - "pinia-plugin-persistedstate": "^3.2.0", + "pinia-plugin-persistedstate": "^3.2.3", "vue": "^3.2.47", "vue-i18n": "^9.2.2" }, diff --git a/package.json b/package.json index e5c9449..cae1c4e 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3081220230802001", "@dcloudio/uni-ui": "^1.5.10", "pinia": "2.0.27", - "pinia-plugin-persistedstate": "^3.2.0", + "pinia-plugin-persistedstate": "^3.2.3", "vue": "^3.2.47", "vue-i18n": "^9.2.2" }, diff --git a/src/stores/modules/member.ts b/src/stores/modules/member.ts index 40e2974..5658fa0 100644 --- a/src/stores/modules/member.ts +++ b/src/stores/modules/member.ts @@ -27,6 +27,17 @@ export const useMemberStore = defineStore( }, // TODO: 持久化 { - persist: true, + // 配置持久化 + persist: { + // 调整为兼容多端的API + storage: { + setItem(key, value) { + uni.setStorageSync(key, value) + }, + getItem(key) { + return uni.getStorageSync(key) + }, + }, + }, }, )