mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
perf: 简化store
文件中导出和导入用法
This commit is contained in:
parent
5d3a9dff46
commit
4cbf9056b1
@ -1,8 +1,12 @@
|
||||
import { store } from "@/store";
|
||||
import { defineStore } from "pinia";
|
||||
import type { appType } from "./types";
|
||||
import { getConfig, responsiveStorageNameSpace } from "@/config";
|
||||
import { deviceDetection, storageLocal } from "@pureadmin/utils";
|
||||
import {
|
||||
type appType,
|
||||
store,
|
||||
getConfig,
|
||||
defineStore,
|
||||
storageLocal,
|
||||
deviceDetection,
|
||||
responsiveStorageNameSpace
|
||||
} from "../utils";
|
||||
|
||||
export const useAppStore = defineStore({
|
||||
id: "pure-app",
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { store } from "@/store";
|
||||
import { defineStore } from "pinia";
|
||||
import { storageLocal } from "@pureadmin/utils";
|
||||
import { getConfig, responsiveStorageNameSpace } from "@/config";
|
||||
import {
|
||||
store,
|
||||
getConfig,
|
||||
defineStore,
|
||||
storageLocal,
|
||||
responsiveStorageNameSpace
|
||||
} from "../utils";
|
||||
|
||||
export const useEpThemeStore = defineStore({
|
||||
id: "pure-epTheme",
|
||||
|
@ -1,10 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { store } from "@/store";
|
||||
import { routerArrays } from "@/layout/types";
|
||||
import {
|
||||
type multiType,
|
||||
type positionType,
|
||||
store,
|
||||
isUrl,
|
||||
isEqual,
|
||||
isBoolean,
|
||||
defineStore,
|
||||
routerArrays,
|
||||
storageLocal,
|
||||
responsiveStorageNameSpace
|
||||
} from "../utils";
|
||||
import { usePermissionStoreHook } from "./permission";
|
||||
import { responsiveStorageNameSpace } from "@/config";
|
||||
import type { multiType, positionType } from "./types";
|
||||
import { isEqual, isBoolean, isUrl, storageLocal } from "@pureadmin/utils";
|
||||
|
||||
export const useMultiTagsStore = defineStore({
|
||||
id: "pure-multiTags",
|
||||
|
@ -1,15 +1,16 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { store } from "@/store";
|
||||
import type { cacheType } from "./types";
|
||||
import { constantMenus } from "@/router";
|
||||
import { useMultiTagsStoreHook } from "./multiTags";
|
||||
import { debounce, getKeyList } from "@pureadmin/utils";
|
||||
import {
|
||||
type cacheType,
|
||||
store,
|
||||
debounce,
|
||||
ascending,
|
||||
getKeyList,
|
||||
filterTree,
|
||||
defineStore,
|
||||
constantMenus,
|
||||
filterNoPermissionTree,
|
||||
formatFlatteningRoutes
|
||||
} from "@/router/utils";
|
||||
} from "../utils";
|
||||
import { useMultiTagsStoreHook } from "./multiTags";
|
||||
|
||||
export const usePermissionStore = defineStore({
|
||||
id: "pure-permission",
|
||||
|
@ -1,7 +1,4 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { store } from "@/store";
|
||||
import { getConfig } from "@/config";
|
||||
import type { setType } from "./types";
|
||||
import { type setType, store, defineStore, getConfig } from "../utils";
|
||||
|
||||
export const useSettingStore = defineStore({
|
||||
id: "pure-setting",
|
||||
|
@ -1,12 +1,19 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { store } from "@/store";
|
||||
import type { userType } from "./types";
|
||||
import { routerArrays } from "@/layout/types";
|
||||
import { router, resetRouter } from "@/router";
|
||||
import { storageLocal } from "@pureadmin/utils";
|
||||
import { getLogin, refreshTokenApi } from "@/api/user";
|
||||
import type { UserResult, RefreshTokenResult } from "@/api/user";
|
||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||
import {
|
||||
type userType,
|
||||
store,
|
||||
router,
|
||||
defineStore,
|
||||
resetRouter,
|
||||
routerArrays,
|
||||
storageLocal
|
||||
} from "../utils";
|
||||
import {
|
||||
type UserResult,
|
||||
type RefreshTokenResult,
|
||||
getLogin,
|
||||
refreshTokenApi
|
||||
} from "@/api/user";
|
||||
import { useMultiTagsStoreHook } from "./multiTags";
|
||||
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
||||
|
||||
export const useUserStore = defineStore({
|
||||
|
28
src/store/utils.ts
Normal file
28
src/store/utils.ts
Normal file
@ -0,0 +1,28 @@
|
||||
export { store } from "@/store";
|
||||
export { defineStore } from "pinia";
|
||||
export { routerArrays } from "@/layout/types";
|
||||
export { router, resetRouter, constantMenus } from "@/router";
|
||||
export { getConfig, responsiveStorageNameSpace } from "@/config";
|
||||
export {
|
||||
ascending,
|
||||
filterTree,
|
||||
filterNoPermissionTree,
|
||||
formatFlatteningRoutes
|
||||
} from "@/router/utils";
|
||||
export {
|
||||
isUrl,
|
||||
isEqual,
|
||||
debounce,
|
||||
isBoolean,
|
||||
getKeyList,
|
||||
storageLocal,
|
||||
deviceDetection
|
||||
} from "@pureadmin/utils";
|
||||
export type {
|
||||
setType,
|
||||
appType,
|
||||
userType,
|
||||
multiType,
|
||||
cacheType,
|
||||
positionType
|
||||
} from "./types";
|
Loading…
x
Reference in New Issue
Block a user