mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 00:26:20 +08:00
chore: miscellaneous modifications
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
"lint-staged": "^10.5.1",
|
||||
"portfinder": "^1.0.28",
|
||||
"postcss-import": "^12.0.1",
|
||||
"prettier": "^2.1.2",
|
||||
"prettier": "^2.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup-plugin-visualizer": "^4.1.2",
|
||||
"stylelint": "^13.8.0",
|
||||
|
@@ -20,7 +20,9 @@ const {
|
||||
} = ENV;
|
||||
|
||||
if (!reg.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||
warn(`VITE_GLOB_APP_SHORT_NAME 变量只能是字符/下划线,请在环境变量中修改并重新运行。`);
|
||||
warn(
|
||||
`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`
|
||||
);
|
||||
}
|
||||
|
||||
export const useSetting = (): SettingWrap => {
|
||||
|
@@ -18,11 +18,7 @@ const router = createRouter({
|
||||
|
||||
// reset router
|
||||
export function resetRouter() {
|
||||
const resetWhiteNameList = [
|
||||
'Login',
|
||||
'Root',
|
||||
// 'FullErrorPage'
|
||||
];
|
||||
const resetWhiteNameList = ['Login', 'Root'];
|
||||
router.getRoutes().forEach((route) => {
|
||||
const { name } = route;
|
||||
if (name && !resetWhiteNameList.includes(name as string)) {
|
||||
|
1
src/router/types.d.ts
vendored
1
src/router/types.d.ts
vendored
@@ -69,6 +69,7 @@ export interface Menu {
|
||||
|
||||
tag?: MenuTag;
|
||||
}
|
||||
|
||||
export interface MenuModule {
|
||||
orderNo?: number;
|
||||
menu: Menu;
|
||||
|
@@ -81,7 +81,7 @@ class App extends VuexModule {
|
||||
public async setPageLoadingAction(loading: boolean): Promise<void> {
|
||||
if (loading) {
|
||||
clearTimeout(timeId);
|
||||
// 防止闪动
|
||||
// Prevent flicker
|
||||
timeId = setTimeout(() => {
|
||||
this.commitPageLoadingState(loading);
|
||||
}, 100);
|
||||
@@ -91,9 +91,9 @@ class App extends VuexModule {
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description: unlock page
|
||||
// */
|
||||
/**
|
||||
* @description: unlock page
|
||||
*/
|
||||
@Action
|
||||
public async unLockAction({ password, valid = true }: { password: string; valid?: boolean }) {
|
||||
if (!valid) {
|
||||
@@ -125,5 +125,4 @@ class App extends VuexModule {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
export { App };
|
||||
export const appStore = getModule<App>(App);
|
||||
|
@@ -78,5 +78,4 @@ class Error extends VuexModule implements ErrorState {
|
||||
this.commitErrorInfoState(errInfo as ErrorInfo);
|
||||
}
|
||||
}
|
||||
export { Error };
|
||||
export const errorStore = getModule<Error>(Error);
|
||||
|
@@ -64,5 +64,4 @@ class Menu extends VuexModule {
|
||||
}
|
||||
}
|
||||
|
||||
export { Menu };
|
||||
export const menuStore = getModule<Menu>(Menu);
|
||||
|
@@ -128,5 +128,4 @@ class Permission extends VuexModule {
|
||||
return routes;
|
||||
}
|
||||
}
|
||||
export { Permission };
|
||||
export const permissionStore = getModule<Permission>(Permission);
|
||||
|
@@ -15,6 +15,7 @@ import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/constant';
|
||||
import { getCurrentTo } from '/@/utils/helper/routeHelper';
|
||||
|
||||
type CacheName = string | symbol | null | undefined;
|
||||
|
||||
/**
|
||||
* @description: vuex Tab模块
|
||||
*/
|
||||
@@ -29,6 +30,7 @@ export interface TabItem {
|
||||
}
|
||||
|
||||
const NAME = 'tab';
|
||||
|
||||
hotModuleUnregisterModule(NAME);
|
||||
|
||||
const getOpenKeepAliveRef = computed(() => appStore.getProjectConfig.openKeepAlive);
|
||||
@@ -252,5 +254,4 @@ class Tab extends VuexModule {
|
||||
this.closeMultipleTab({ pathList, nameList });
|
||||
}
|
||||
}
|
||||
export { Tab };
|
||||
export const tabStore = getModule<Tab>(Tab);
|
||||
|
@@ -154,5 +154,4 @@ class User extends VuexModule {
|
||||
});
|
||||
}
|
||||
}
|
||||
export { User };
|
||||
export const userStore = getModule<User>(User);
|
||||
|
2
src/types/config.d.ts
vendored
2
src/types/config.d.ts
vendored
@@ -138,9 +138,11 @@ export type SetProjectSettingFn = <T extends keyof ProjectConfig>(
|
||||
key: T,
|
||||
value: ProjectConfig[T]
|
||||
) => void;
|
||||
|
||||
interface GlobWrap {
|
||||
globSetting: Readonly<GlobConfig>;
|
||||
}
|
||||
|
||||
interface ProjectSettingWrap {
|
||||
projectSetting: Readonly<ProjectConfig>;
|
||||
}
|
||||
|
6
src/types/global.d.ts
vendored
6
src/types/global.d.ts
vendored
@@ -37,6 +37,12 @@ declare type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
|
||||
// type DeepPartial<T> = T extends Function
|
||||
// ? T
|
||||
// : T extends object
|
||||
// ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
// : T;
|
||||
|
||||
declare type LabelValueOptions = {
|
||||
label: string;
|
||||
value: any;
|
||||
|
10
src/types/shim-tsx.d.ts
vendored
10
src/types/shim-tsx.d.ts
vendored
@@ -13,21 +13,13 @@ declare global {
|
||||
// tslint:disable no-empty-interface
|
||||
type ElementClass = ComponentRenderProxy;
|
||||
interface ElementAttributesProperty {
|
||||
$props: any; // 定义要使用的属性名称
|
||||
$props: any;
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
// ['v-if']?: unknown;
|
||||
// ['v-else-if']?: unknown;
|
||||
// ['v-else']?: unknown;
|
||||
// need
|
||||
// ['v-show']?: unknown;
|
||||
[elem: string]: any;
|
||||
// ['v-html']?: unknown;
|
||||
// ['v-text']?: unknown;
|
||||
// ['v-model']?: unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { dataURLtoBlob, urlToBase64 } from './stream';
|
||||
import { dataURLtoBlob, urlToBase64 } from './base64';
|
||||
|
||||
/**
|
||||
* Download online pictures
|
||||
|
@@ -7,8 +7,8 @@ const ls = createStorage(localStorage);
|
||||
const ss = createStorage();
|
||||
|
||||
interface CacheStore {
|
||||
local?: any;
|
||||
session?: any;
|
||||
local: Record<string, any>;
|
||||
session: Record<string, any>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,14 +25,14 @@ function initCache() {
|
||||
cacheStore.local = ls.get(BASE_LOCAL_CACHE_KEY) || {};
|
||||
cacheStore.session = ss.get(BASE_SESSION_CACHE_KEY) || {};
|
||||
}
|
||||
|
||||
initCache();
|
||||
|
||||
export function setLocal(key: string, value: any, immediate = false) {
|
||||
cacheStore.local[BASE_LOCAL_CACHE_KEY] = cacheStore.local[BASE_LOCAL_CACHE_KEY] || {};
|
||||
cacheStore.local[BASE_LOCAL_CACHE_KEY][key] = value;
|
||||
if (immediate) {
|
||||
const localCache = cacheStore.local;
|
||||
ls.set(BASE_LOCAL_CACHE_KEY, localCache);
|
||||
ls.set(BASE_LOCAL_CACHE_KEY, cacheStore.local);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ export function getLocal<T>(key: string): T | null {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function removeLocal(key: string) {
|
||||
if (cacheStore.local[BASE_LOCAL_CACHE_KEY]) {
|
||||
Reflect.deleteProperty(cacheStore.local[BASE_LOCAL_CACHE_KEY], key);
|
||||
@@ -91,8 +92,6 @@ export function clearAll() {
|
||||
const localCache = cacheStore.local;
|
||||
const sessionCache = cacheStore.session;
|
||||
|
||||
// const ss = createStorage();
|
||||
|
||||
ls.set(BASE_LOCAL_CACHE_KEY, localCache);
|
||||
ss.set(BASE_SESSION_CACHE_KEY, sessionCache);
|
||||
});
|
||||
@@ -114,6 +113,7 @@ export function clearAll() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isIeFn() && (document as any).attachEvent) {
|
||||
(document as any).attachEvent('onstorage', storageChange);
|
||||
} else {
|
||||
|
@@ -158,6 +158,7 @@ export function forEach<T = any>(
|
||||
export function treeMap(treeData: any[], opt: { children?: string; conversion: Fn }) {
|
||||
return treeData.map((item) => treeMapEach(item, opt));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 提取tree指定结构
|
||||
*/
|
||||
|
@@ -6343,10 +6343,10 @@ prettier-linter-helpers@^1.0.0:
|
||||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
|
||||
integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==
|
||||
prettier@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b"
|
||||
integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==
|
||||
|
||||
pretty-bytes@^5.3.0:
|
||||
version "5.4.1"
|
||||
|
Reference in New Issue
Block a user