页面配置持久化问题
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"query-string": "^8.1.0",
|
"query-string": "^8.1.0",
|
||||||
"sortablejs": "^1.15.1",
|
"sortablejs": "^1.15.1",
|
||||||
"v-viewer": "^3.0.10",
|
"v-viewer": "^3.0.10",
|
||||||
|
11
pnpm-lock.yaml
generated
11
pnpm-lock.yaml
generated
@@ -53,6 +53,9 @@ dependencies:
|
|||||||
pinia:
|
pinia:
|
||||||
specifier: ^2.1.7
|
specifier: ^2.1.7
|
||||||
version: 2.1.7(typescript@5.4.3)(vue@3.3.7)
|
version: 2.1.7(typescript@5.4.3)(vue@3.3.7)
|
||||||
|
pinia-plugin-persistedstate:
|
||||||
|
specifier: ^3.2.1
|
||||||
|
version: 3.2.1(pinia@2.1.7)
|
||||||
query-string:
|
query-string:
|
||||||
specifier: ^8.1.0
|
specifier: ^8.1.0
|
||||||
version: 8.2.0
|
version: 8.2.0
|
||||||
@@ -6797,6 +6800,14 @@ packages:
|
|||||||
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
|
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
|
/pinia-plugin-persistedstate@3.2.1(pinia@2.1.7):
|
||||||
|
resolution: {integrity: sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==}
|
||||||
|
peerDependencies:
|
||||||
|
pinia: ^2.0.0
|
||||||
|
dependencies:
|
||||||
|
pinia: 2.1.7(typescript@5.4.3)(vue@3.3.7)
|
||||||
|
dev: false
|
||||||
|
|
||||||
/pinia@2.1.7(typescript@5.4.3)(vue@3.3.7):
|
/pinia@2.1.7(typescript@5.4.3)(vue@3.3.7):
|
||||||
resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==}
|
resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
|
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
|
||||||
import useAppStore from './modules/app';
|
import useAppStore from './modules/app';
|
||||||
import useUserStore from './modules/user';
|
import useUserStore from './modules/user';
|
||||||
import useDictStore from './modules/dict';
|
import useDictStore from './modules/dict';
|
||||||
import useTabBarStore from './modules/tab-bar';
|
import useTabBarStore from './modules/tab-bar';
|
||||||
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
|
pinia.use(piniaPluginPersistedstate);
|
||||||
export { useAppStore, useUserStore, useDictStore, useTabBarStore };
|
export { useAppStore, useUserStore, useDictStore, useTabBarStore };
|
||||||
export default pinia;
|
export default pinia;
|
||||||
|
@@ -27,7 +27,6 @@ const recursionMenu = (
|
|||||||
};
|
};
|
||||||
const useAppStore = defineStore('app', {
|
const useAppStore = defineStore('app', {
|
||||||
state: (): AppState => ({ ...defaultSettings, config: {} }),
|
state: (): AppState => ({ ...defaultSettings, config: {} }),
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
appCurrentSetting(state: AppState): AppState {
|
appCurrentSetting(state: AppState): AppState {
|
||||||
return { ...state };
|
return { ...state };
|
||||||
@@ -155,6 +154,7 @@ const useAppStore = defineStore('app', {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
persist: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default useAppStore;
|
export default useAppStore;
|
||||||
|
Reference in New Issue
Block a user