Skip to content

Commit 3be088e

Browse files
committed
2023-11-29 feat: 持久化缓存
1 parent 8f14355 commit 3be088e

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"mitt": "^3.0.1",
5656
"nprogress": "^0.2.0",
5757
"pinia": "^2.1.7",
58-
"pinia-plugin-persist": "^1.0.0",
58+
"pinia-plugin-persistedstate": "^3.2.0",
5959
"qrcode": "^1.5.3",
6060
"qs": "^6.11.2",
6161
"steady-xml": "^0.1.0",

src/store/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { App } from 'vue'
22
import { createPinia } from 'pinia'
3-
import piniaPersist from 'pinia-plugin-persist'
3+
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
44

55
const store = createPinia()
6-
store.use(piniaPersist)
6+
store.use(piniaPluginPersistedstate)
77

88
export const setupStore = (app: App<Element>) => {
99
app.use(store)

src/store/modules/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ export const useAppStore = defineStore('app', {
268268
setFooter(footer: boolean) {
269269
this.footer = footer
270270
}
271-
}
271+
},
272+
persist: false
272273
})
273274

274275
export const useAppStoreWithOut = () => {

src/store/modules/lock.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ interface LockState {
1010
lockInfo: lockInfo
1111
}
1212

13-
// TODO 芋艿:【锁屏】这里有报错,后续解决下
1413
export const useLockStore = defineStore('lock', {
1514
state: (): LockState => {
1615
return {
@@ -41,10 +40,7 @@ export const useLockStore = defineStore('lock', {
4140
}
4241
}
4342
},
44-
persist: {
45-
enabled: true,
46-
strategies: [{ key: 'lock', storage: localStorage }]
47-
}
43+
persist: true
4844
})
4945

5046
export const useLockStoreWithOut = () => {

src/store/modules/permission.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export const usePermissionStore = defineStore('permission', {
5959
setMenuTabRouters(routers: AppRouteRecordRaw[]): void {
6060
this.menuTabRouters = routers
6161
}
62-
}
62+
},
63+
persist: false
6364
})
6465

6566
export const usePermissionStoreWithOut = () => {

src/store/modules/tagsView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ export const useTagsViewStore = defineStore('tagsView', {
132132
}
133133
}
134134
}
135-
}
135+
},
136+
persist: false
136137
})
137138

138139
export const useTagsViewStoreWithOut = () => {

0 commit comments

Comments
 (0)