From e4dd8e1ce9a243c0711601f1ce9b4e76b8615ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Sun, 26 Dec 2021 13:19:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor(store):=20=E7=A7=BB=E9=99=A4=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +--- src/store/modules/app.ts | 2 +- src/store/modules/permission.ts | 2 +- src/store/modules/settings.ts | 2 +- src/store/modules/tagsView.ts | 2 +- src/store/modules/user.ts | 4 ++-- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index d73047f4..1c803cbf 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,7 @@ "pinia": "^2.0.9", "screenfull": "^6.0.0", "vue": "^3.2.16", - "vue-router": "^4.0.12", - "vue3-treeselect": "^0.1.10", - "vuex": "^4.0.2" + "vue-router": "^4.0.12" }, "devDependencies": { "@types/node": "^16.11.7", diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index 80288e4d..aaeb6212 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -4,7 +4,7 @@ import { store } from "@/store"; import { defineStore } from "pinia"; export const useAppStore = defineStore({ - id: "youlai-app", + id: "app", state: ():AppState=>({ device: 'desktop', sidebar: { diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 7422f85a..5864a8a5 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -46,7 +46,7 @@ export const filterAsyncRoutes = (routes: RouteRecordRaw[], roles: string[]) => export const usePermissionStore = defineStore({ - id:"youlai-permission", + id:"permission", state:():PermissionState=>( { routes: [], addRoutes: [] diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 7e556f3f..0964f048 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -6,7 +6,7 @@ import defaultSettings from '../../settings' const {showSettings, tagsView, fixedHeader, sidebarLogo} = defaultSettings export const useSettingStore = defineStore({ - id: "pure-setting", + id: "setting", state:():SettingState =>({ theme: '', showSettings: showSettings, diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts index 4d296af9..8e45852c 100644 --- a/src/store/modules/tagsView.ts +++ b/src/store/modules/tagsView.ts @@ -4,7 +4,7 @@ import { store } from "@/store"; import {TagsViewState} from "@store/interface"; const tagsViewStore=defineStore({ - id:"youlai-tagsView", + id:"tagsView", state:():TagsViewState=>( { visitedViews: [], cachedViews: [] diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b37554d4..3fe03199 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,6 +1,6 @@ import { defineStore } from "pinia"; import { store } from "@/store"; -import {UserState, RootStateTypes} from "@store/interface"; +import {UserState} from "@store/interface"; import {Local} from "@utils/storage"; import {getUserInfo, login, logout} from "@api/login"; import {resetRouter} from "@router"; @@ -17,7 +17,7 @@ const getDefaultState = () => { } export const useUserStore = defineStore({ - id:"youlai-user", + id:"user", state: ():UserState=>({ token: Local.get('token') || '', nickname: '',