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