feat: pinia缓存依赖修改
This commit is contained in:
parent
0b39e81952
commit
83351edc48
@ -25,7 +25,7 @@
|
||||
"dc-admin": "link:",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"vue": "^3.4.21",
|
||||
"vue-i18n": "10.0.0-alpha.3",
|
||||
"vue-router": "^4.3.0"
|
||||
|
||||
32
pnpm-lock.yaml
generated
32
pnpm-lock.yaml
generated
@ -10,9 +10,9 @@ dependencies:
|
||||
pinia:
|
||||
specifier: ^2.1.7
|
||||
version: 2.1.7(typescript@5.4.3)(vue@3.4.21)
|
||||
pinia-plugin-persist:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(pinia@2.1.7)(vue@3.4.21)
|
||||
pinia-plugin-persistedstate:
|
||||
specifier: ^3.2.1
|
||||
version: 3.2.1(pinia@2.1.7)
|
||||
vue:
|
||||
specifier: ^3.4.21
|
||||
version: 3.4.21(typescript@5.4.3)
|
||||
@ -3842,19 +3842,12 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/pinia-plugin-persist@1.0.0(pinia@2.1.7)(vue@3.4.21):
|
||||
resolution: {integrity: sha512-M4hBBd8fz/GgNmUPaaUsC29y1M09lqbXrMAHcusVoU8xlQi1TqgkWnnhvMikZwr7Le/hVyMx8KUcumGGrR6GVw==}
|
||||
/pinia-plugin-persistedstate@3.2.1(pinia@2.1.7):
|
||||
resolution: {integrity: sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==}
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.0.0
|
||||
pinia: ^2.0.0
|
||||
vue: ^2.0.0 || >=3.0.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
dependencies:
|
||||
pinia: 2.1.7(typescript@5.4.3)(vue@3.4.21)
|
||||
vue: 3.4.21(typescript@5.4.3)
|
||||
vue-demi: 0.12.5(vue@3.4.21)
|
||||
dev: false
|
||||
|
||||
/pinia@2.1.7(typescript@5.4.3)(vue@3.4.21):
|
||||
@ -5137,21 +5130,6 @@ packages:
|
||||
fsevents: 2.3.3
|
||||
dev: true
|
||||
|
||||
/vue-demi@0.12.5(vue@3.4.21):
|
||||
resolution: {integrity: sha512-BREuTgTYlUr0zw0EZn3hnhC3I6gPWv+Kwh4MCih6QcAeaTlaIX0DwOVN0wHej7hSvDPecz4jygy/idsgKfW58Q==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.0.0-rc.1
|
||||
vue: ^3.0.0-0 || ^2.6.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
dependencies:
|
||||
vue: 3.4.21(typescript@5.4.3)
|
||||
dev: false
|
||||
|
||||
/vue-demi@0.14.7(vue@3.4.21):
|
||||
resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
@ -4,13 +4,12 @@ import App from "@/App.vue";
|
||||
import ArcoVue from "@arco-design/web-vue";
|
||||
import router from "@/router/index";
|
||||
import pinia from "@/store/index";
|
||||
import piniaPluginPersist from "pinia-plugin-persist";
|
||||
import "virtual:svg-icons-register";
|
||||
import "@arco-design/web-vue/dist/arco.css";
|
||||
// 额外引入图标库
|
||||
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
|
||||
// 引入i18n
|
||||
import i18n from "@/lang/index";
|
||||
pinia.use(piniaPluginPersist);
|
||||
const app = createApp(App);
|
||||
app.use(ArcoVue, {
|
||||
componentPrefix: "arco"
|
||||
|
||||
0
src/store/config/config.ts
Normal file
0
src/store/config/config.ts
Normal file
@ -1,9 +1,11 @@
|
||||
// https://pinia.vuejs.org/zh/
|
||||
// store/index.js
|
||||
import { createPinia } from "pinia";
|
||||
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
||||
|
||||
// 创建
|
||||
const pinia = createPinia();
|
||||
pinia.use(piniaPluginPersistedstate);
|
||||
|
||||
// 导出
|
||||
export default pinia;
|
||||
|
||||
@ -4,7 +4,7 @@ import { defineStore } from "pinia";
|
||||
* 全局配置
|
||||
* @methods setCollapsed 设置菜单折叠
|
||||
*/
|
||||
export const useThemeConfig = defineStore("themeConfig", {
|
||||
export const useThemeConfig = defineStore("theme-config", {
|
||||
state: (): any => ({
|
||||
collapsed: false, // 是否折叠菜单
|
||||
refreshPage: true, // 刷新页面
|
||||
@ -12,7 +12,7 @@ export const useThemeConfig = defineStore("themeConfig", {
|
||||
}),
|
||||
actions: {
|
||||
// 折叠菜单
|
||||
async setCollapsed(data: boolean) {
|
||||
setCollapsed(data: boolean) {
|
||||
this.collapsed = data;
|
||||
},
|
||||
// 刷新页面
|
||||
@ -25,7 +25,6 @@ export const useThemeConfig = defineStore("themeConfig", {
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
enabled: true, // 开启数据缓存-默认缓存全部数据
|
||||
key: "themeConfig"
|
||||
key: "theme-config"
|
||||
}
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@ import { defineStore } from "pinia";
|
||||
* @methods setToken 设置token
|
||||
* @methods logOut 退出登录
|
||||
*/
|
||||
export const useUserInfoStore = defineStore("userInfo", {
|
||||
export const useUserInfoStore = defineStore("user-info", {
|
||||
state: (): any => ({
|
||||
account: {
|
||||
username: "",
|
||||
@ -26,7 +26,6 @@ export const useUserInfoStore = defineStore("userInfo", {
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
enabled: true, // 开启数据缓存-默认缓存全部数据
|
||||
key: "userInfo"
|
||||
key: "user-info"
|
||||
}
|
||||
});
|
||||
|
||||
2
src/vite-env.d.ts
vendored
2
src/vite-env.d.ts
vendored
@ -5,4 +5,4 @@ declare module "*.vue" {
|
||||
export default component;
|
||||
}
|
||||
|
||||
declare module "pinia-plugin-persist";
|
||||
declare module "vue-i18n";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user