mirror of
https://github.com/sunniejs/vue-h5-template.git
synced 2025-04-05 07:03:01 +08:00
feat: 修改类型定义
This commit is contained in:
parent
fd28e0515d
commit
34da551fee
@ -15,7 +15,7 @@ module.exports = {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
|
||||
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
|
||||
rules: {
|
||||
'vue/script-setup-uses-vars': 'error',
|
||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||
|
@ -1 +1,9 @@
|
||||
export const IsReport = process.env.REPORT;
|
||||
|
||||
export const API_BASE_URL = '';
|
||||
|
||||
export const MOCK_API_BASE_URL = '';
|
||||
|
||||
export const API_TARGET_URL = '';
|
||||
|
||||
export const MOCK_API_TARGET_URL = '';
|
||||
|
@ -74,7 +74,7 @@
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||
"vue-eslint-parser": "^9.0.3",
|
||||
"vue-tsc": "^0.38.8"
|
||||
"vue-tsc": "^0.38.9"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { AnyObject } from '/#/global';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
|
||||
export function loadLang() {
|
||||
const modules: Record<string, any> = import.meta.glob('./lang/*.ts', { eager: true });
|
||||
const langs: AnyObject = {};
|
||||
const langs: Record<string, any> = {};
|
||||
|
||||
for (const path in modules) {
|
||||
const name = path.replace(/(\.\/lang\/|\.ts)/g, '');
|
||||
|
@ -2,14 +2,13 @@ import { loginPassword } from '/@/api';
|
||||
import { useCookies } from '@vueuse/integrations/useCookies';
|
||||
import { defineStore } from 'pinia';
|
||||
import { watch } from 'vue';
|
||||
import { AnyObject } from '/#/global';
|
||||
|
||||
const { VITE_TOKEN_KEY } = import.meta.env;
|
||||
const token = useCookies().get(VITE_TOKEN_KEY as string);
|
||||
|
||||
interface StoreUser {
|
||||
token: string;
|
||||
info: AnyObject;
|
||||
info: Record<any, any>;
|
||||
}
|
||||
|
||||
export const useUserStore = defineStore({
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { AnyObject } from '/#/global';
|
||||
|
||||
export function typeCheck(param: any) {
|
||||
return Object.prototype.toString.call(param);
|
||||
}
|
||||
@ -7,7 +5,7 @@ export function typeCheck(param: any) {
|
||||
/**
|
||||
* 批量修改stage
|
||||
*/
|
||||
export function mutateState(state: AnyObject, payload: AnyObject) {
|
||||
export function mutateState(state: Record<string, any>, payload: Record<string, any>) {
|
||||
if (typeCheck(state) === '[object Object]' && typeCheck(payload) === '[object Object]') {
|
||||
for (const key in payload) {
|
||||
state[key] = payload[key];
|
||||
|
@ -35,8 +35,8 @@
|
||||
"src/**/*.vue",
|
||||
"types/**/*.d.ts",
|
||||
"types/**/*.ts",
|
||||
"build/**/*.ts",
|
||||
"build/**/*.d.ts",
|
||||
"config/**/*.ts",
|
||||
"config/**/*.d.ts",
|
||||
"mock/**/*.ts",
|
||||
"vite.config.ts"
|
||||
],
|
||||
|
106
types/axios.d.ts
vendored
106
types/axios.d.ts
vendored
@ -1,53 +1,53 @@
|
||||
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
|
||||
|
||||
export interface RequestOptions {
|
||||
// Splicing request parameters to url
|
||||
joinParamsToUrl?: boolean;
|
||||
// Format request parameter time
|
||||
formatDate?: boolean;
|
||||
// Whether to process the request result
|
||||
isTransformResponse?: boolean;
|
||||
// Whether to return native response headers
|
||||
// For example: use this attribute when you need to get the response headers
|
||||
isReturnNativeResponse?: boolean;
|
||||
// Whether to join url
|
||||
joinPrefix?: boolean;
|
||||
// Interface address, use the default apiUrl if you leave it blank
|
||||
apiUrl?: string;
|
||||
// 请求拼接路径
|
||||
urlPrefix?: string;
|
||||
// Error message prompt type
|
||||
errorMessageMode?: ErrorMessageMode;
|
||||
// Whether to add a timestamp
|
||||
joinTime?: boolean;
|
||||
ignoreCancelToken?: boolean;
|
||||
// Whether to send token in header
|
||||
withToken?: boolean;
|
||||
// 请求重试机制
|
||||
retryRequest?: RetryRequest;
|
||||
}
|
||||
|
||||
export interface RetryRequest {
|
||||
isOpenRetry: boolean;
|
||||
count: number;
|
||||
waitTime: number;
|
||||
}
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
type: 'success' | 'error' | 'warning';
|
||||
message: string;
|
||||
result: T;
|
||||
}
|
||||
|
||||
// multipart/form-data: upload file
|
||||
export interface UploadFileParams {
|
||||
// Other parameters
|
||||
data?: Recordable;
|
||||
// File parameter interface field name
|
||||
name?: string;
|
||||
// file name
|
||||
file: File | Blob;
|
||||
// file name
|
||||
filename?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
|
||||
|
||||
export interface RequestOptions {
|
||||
// Splicing request parameters to url
|
||||
joinParamsToUrl?: boolean;
|
||||
// Format request parameter time
|
||||
formatDate?: boolean;
|
||||
// Whether to process the request result
|
||||
isTransformResponse?: boolean;
|
||||
// Whether to return native response headers
|
||||
// For example: use this attribute when you need to get the response headers
|
||||
isReturnNativeResponse?: boolean;
|
||||
// Whether to join url
|
||||
joinPrefix?: boolean;
|
||||
// Interface address, use the default apiUrl if you leave it blank
|
||||
apiUrl?: string;
|
||||
// 请求拼接路径
|
||||
urlPrefix?: string;
|
||||
// Error message prompt type
|
||||
errorMessageMode?: ErrorMessageMode;
|
||||
// Whether to add a timestamp
|
||||
joinTime?: boolean;
|
||||
ignoreCancelToken?: boolean;
|
||||
// Whether to send token in header
|
||||
withToken?: boolean;
|
||||
// 请求重试机制
|
||||
retryRequest?: RetryRequest;
|
||||
}
|
||||
|
||||
export interface RetryRequest {
|
||||
isOpenRetry: boolean;
|
||||
count: number;
|
||||
waitTime: number;
|
||||
}
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
type: 'success' | 'error' | 'warning';
|
||||
message: string;
|
||||
result: T;
|
||||
}
|
||||
|
||||
// multipart/form-data: upload file
|
||||
export interface UploadFileParams {
|
||||
// Other parameters
|
||||
data?: Recordable;
|
||||
// File parameter interface field name
|
||||
name?: string;
|
||||
// file name
|
||||
file: File | Blob;
|
||||
// file name
|
||||
filename?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
323
types/config.d.ts
vendored
323
types/config.d.ts
vendored
@ -1,161 +1,162 @@
|
||||
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum';
|
||||
import {
|
||||
ContentEnum,
|
||||
PermissionModeEnum,
|
||||
ThemeEnum,
|
||||
RouterTransitionEnum,
|
||||
SettingButtonPositionEnum,
|
||||
SessionTimeoutProcessingEnum,
|
||||
} from '/@/enums/appEnum';
|
||||
|
||||
import { CacheTypeEnum } from '/@/enums/cacheEnum';
|
||||
|
||||
export type LocaleType = 'zh_CN' | 'en' | 'ru' | 'ja' | 'ko';
|
||||
|
||||
export interface MenuSetting {
|
||||
bgColor: string;
|
||||
fixed: boolean;
|
||||
collapsed: boolean;
|
||||
canDrag: boolean;
|
||||
show: boolean;
|
||||
hidden: boolean;
|
||||
split: boolean;
|
||||
menuWidth: number;
|
||||
mode: MenuModeEnum;
|
||||
type: MenuTypeEnum;
|
||||
theme: ThemeEnum;
|
||||
topMenuAlign: 'start' | 'center' | 'end';
|
||||
trigger: TriggerEnum;
|
||||
accordion: boolean;
|
||||
closeMixSidebarOnChange: boolean;
|
||||
collapsedShowTitle: boolean;
|
||||
mixSideTrigger: MixSidebarTriggerEnum;
|
||||
mixSideFixed: boolean;
|
||||
}
|
||||
|
||||
export interface MultiTabsSetting {
|
||||
cache: boolean;
|
||||
show: boolean;
|
||||
showQuick: boolean;
|
||||
canDrag: boolean;
|
||||
showRedo: boolean;
|
||||
showFold: boolean;
|
||||
}
|
||||
|
||||
export interface HeaderSetting {
|
||||
bgColor: string;
|
||||
fixed: boolean;
|
||||
show: boolean;
|
||||
theme: ThemeEnum;
|
||||
// Turn on full screen
|
||||
showFullScreen: boolean;
|
||||
// Whether to show the lock screen
|
||||
useLockPage: boolean;
|
||||
// Show document button
|
||||
showDoc: boolean;
|
||||
// Show message center button
|
||||
showNotice: boolean;
|
||||
showSearch: boolean;
|
||||
}
|
||||
|
||||
export interface LocaleSetting {
|
||||
showPicker: boolean;
|
||||
// Current language
|
||||
locale: LocaleType;
|
||||
// default language
|
||||
fallback: LocaleType;
|
||||
// available Locales
|
||||
availableLocales: LocaleType[];
|
||||
}
|
||||
|
||||
export interface TransitionSetting {
|
||||
// Whether to open the page switching animation
|
||||
enable: boolean;
|
||||
// Route basic switching animation
|
||||
basicTransition: RouterTransitionEnum;
|
||||
// Whether to open page switching loading
|
||||
openPageLoading: boolean;
|
||||
// Whether to open the top progress bar
|
||||
openNProgress: boolean;
|
||||
}
|
||||
|
||||
export interface ProjectConfig {
|
||||
// Storage location of permission related information
|
||||
permissionCacheType: CacheTypeEnum;
|
||||
// Whether to show the configuration button
|
||||
showSettingButton: boolean;
|
||||
// Whether to show the theme switch button
|
||||
showDarkModeToggle: boolean;
|
||||
// Configure where the button is displayed
|
||||
settingButtonPosition: SettingButtonPositionEnum;
|
||||
// Permission mode
|
||||
permissionMode: PermissionModeEnum;
|
||||
// Session timeout processing
|
||||
sessionTimeoutProcessing: SessionTimeoutProcessingEnum;
|
||||
// Website gray mode, open for possible mourning dates
|
||||
grayMode: boolean;
|
||||
// Whether to turn on the color weak mode
|
||||
colorWeak: boolean;
|
||||
// Theme color
|
||||
themeColor: string;
|
||||
|
||||
// The main interface is displayed in full screen, the menu is not displayed, and the top
|
||||
fullContent: boolean;
|
||||
// content width
|
||||
contentMode: ContentEnum;
|
||||
// Whether to display the logo
|
||||
showLogo: boolean;
|
||||
// Whether to show the global footer
|
||||
showFooter: boolean;
|
||||
// menuType: MenuTypeEnum;
|
||||
headerSetting: HeaderSetting;
|
||||
// menuSetting
|
||||
menuSetting: MenuSetting;
|
||||
// Multi-tab settings
|
||||
multiTabsSetting: MultiTabsSetting;
|
||||
// Animation configuration
|
||||
transitionSetting: TransitionSetting;
|
||||
// pageLayout whether to enable keep-alive
|
||||
openKeepAlive: boolean;
|
||||
// Lock screen time
|
||||
lockTime: number;
|
||||
// Show breadcrumbs
|
||||
showBreadCrumb: boolean;
|
||||
// Show breadcrumb icon
|
||||
showBreadCrumbIcon: boolean;
|
||||
// Use error-handler-plugin
|
||||
useErrorHandle: boolean;
|
||||
// Whether to open back to top
|
||||
useOpenBackTop: boolean;
|
||||
// Is it possible to embed iframe pages
|
||||
canEmbedIFramePage: boolean;
|
||||
// Whether to delete unclosed messages and notify when switching the interface
|
||||
closeMessageOnSwitch: boolean;
|
||||
// Whether to cancel the http request that has been sent but not responded when switching the interface.
|
||||
removeAllHttpPending: boolean;
|
||||
}
|
||||
|
||||
export interface GlobConfig {
|
||||
// Site title
|
||||
title: string;
|
||||
// Service interface url
|
||||
apiUrl: string;
|
||||
// Upload url
|
||||
uploadUrl?: string;
|
||||
// Service interface url prefix
|
||||
urlPrefix?: string;
|
||||
// Project abbreviation
|
||||
shortName: string;
|
||||
}
|
||||
export interface GlobEnvConfig {
|
||||
// Site title
|
||||
VITE_GLOB_APP_TITLE: string;
|
||||
// Service interface url
|
||||
VITE_GLOB_API_URL: string;
|
||||
// Service interface url prefix
|
||||
VITE_GLOB_API_URL_PREFIX?: string;
|
||||
// Project abbreviation
|
||||
VITE_GLOB_APP_SHORT_NAME: string;
|
||||
// Upload url
|
||||
VITE_GLOB_UPLOAD_URL?: string;
|
||||
}
|
||||
import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum';
|
||||
import {
|
||||
ContentEnum,
|
||||
PermissionModeEnum,
|
||||
ThemeEnum,
|
||||
RouterTransitionEnum,
|
||||
SettingButtonPositionEnum,
|
||||
SessionTimeoutProcessingEnum,
|
||||
} from '/@/enums/appEnum';
|
||||
|
||||
import { CacheTypeEnum } from '/@/enums/cacheEnum';
|
||||
|
||||
export type LocaleType = 'zh_CN' | 'en' | 'ru' | 'ja' | 'ko';
|
||||
|
||||
export interface MenuSetting {
|
||||
bgColor: string;
|
||||
fixed: boolean;
|
||||
collapsed: boolean;
|
||||
siderHidden: boolean;
|
||||
canDrag: boolean;
|
||||
show: boolean;
|
||||
hidden: boolean;
|
||||
split: boolean;
|
||||
menuWidth: number;
|
||||
mode: MenuModeEnum;
|
||||
type: MenuTypeEnum;
|
||||
theme: ThemeEnum;
|
||||
topMenuAlign: 'start' | 'center' | 'end';
|
||||
trigger: TriggerEnum;
|
||||
accordion: boolean;
|
||||
closeMixSidebarOnChange: boolean;
|
||||
collapsedShowTitle: boolean;
|
||||
mixSideTrigger: MixSidebarTriggerEnum;
|
||||
mixSideFixed: boolean;
|
||||
}
|
||||
|
||||
export interface MultiTabsSetting {
|
||||
cache: boolean;
|
||||
show: boolean;
|
||||
showQuick: boolean;
|
||||
canDrag: boolean;
|
||||
showRedo: boolean;
|
||||
showFold: boolean;
|
||||
}
|
||||
|
||||
export interface HeaderSetting {
|
||||
bgColor: string;
|
||||
fixed: boolean;
|
||||
show: boolean;
|
||||
theme: ThemeEnum;
|
||||
// Turn on full screen
|
||||
showFullScreen: boolean;
|
||||
// Whether to show the lock screen
|
||||
useLockPage: boolean;
|
||||
// Show document button
|
||||
showDoc: boolean;
|
||||
// Show message center button
|
||||
showNotice: boolean;
|
||||
showSearch: boolean;
|
||||
}
|
||||
|
||||
export interface LocaleSetting {
|
||||
showPicker: boolean;
|
||||
// Current language
|
||||
locale: LocaleType;
|
||||
// default language
|
||||
fallback: LocaleType;
|
||||
// available Locales
|
||||
availableLocales: LocaleType[];
|
||||
}
|
||||
|
||||
export interface TransitionSetting {
|
||||
// Whether to open the page switching animation
|
||||
enable: boolean;
|
||||
// Route basic switching animation
|
||||
basicTransition: RouterTransitionEnum;
|
||||
// Whether to open page switching loading
|
||||
openPageLoading: boolean;
|
||||
// Whether to open the top progress bar
|
||||
openNProgress: boolean;
|
||||
}
|
||||
|
||||
export interface ProjectConfig {
|
||||
// Storage location of permission related information
|
||||
permissionCacheType: CacheTypeEnum;
|
||||
// Whether to show the configuration button
|
||||
showSettingButton: boolean;
|
||||
// Whether to show the theme switch button
|
||||
showDarkModeToggle: boolean;
|
||||
// Configure where the button is displayed
|
||||
settingButtonPosition: SettingButtonPositionEnum;
|
||||
// Permission mode
|
||||
permissionMode: PermissionModeEnum;
|
||||
// Session timeout processing
|
||||
sessionTimeoutProcessing: SessionTimeoutProcessingEnum;
|
||||
// Website gray mode, open for possible mourning dates
|
||||
grayMode: boolean;
|
||||
// Whether to turn on the color weak mode
|
||||
colorWeak: boolean;
|
||||
// Theme color
|
||||
themeColor: string;
|
||||
|
||||
// The main interface is displayed in full screen, the menu is not displayed, and the top
|
||||
fullContent: boolean;
|
||||
// content width
|
||||
contentMode: ContentEnum;
|
||||
// Whether to display the logo
|
||||
showLogo: boolean;
|
||||
// Whether to show the global footer
|
||||
showFooter: boolean;
|
||||
// menuType: MenuTypeEnum;
|
||||
headerSetting: HeaderSetting;
|
||||
// menuSetting
|
||||
menuSetting: MenuSetting;
|
||||
// Multi-tab settings
|
||||
multiTabsSetting: MultiTabsSetting;
|
||||
// Animation configuration
|
||||
transitionSetting: TransitionSetting;
|
||||
// pageLayout whether to enable keep-alive
|
||||
openKeepAlive: boolean;
|
||||
// Lock screen time
|
||||
lockTime: number;
|
||||
// Show breadcrumbs
|
||||
showBreadCrumb: boolean;
|
||||
// Show breadcrumb icon
|
||||
showBreadCrumbIcon: boolean;
|
||||
// Use error-handler-plugin
|
||||
useErrorHandle: boolean;
|
||||
// Whether to open back to top
|
||||
useOpenBackTop: boolean;
|
||||
// Is it possible to embed iframe pages
|
||||
canEmbedIFramePage: boolean;
|
||||
// Whether to delete unclosed messages and notify when switching the interface
|
||||
closeMessageOnSwitch: boolean;
|
||||
// Whether to cancel the http request that has been sent but not responded when switching the interface.
|
||||
removeAllHttpPending: boolean;
|
||||
}
|
||||
|
||||
export interface GlobConfig {
|
||||
// Site title
|
||||
title: string;
|
||||
// Service interface url
|
||||
apiUrl: string;
|
||||
// Upload url
|
||||
uploadUrl?: string;
|
||||
// Service interface url prefix
|
||||
urlPrefix?: string;
|
||||
// Project abbreviation
|
||||
shortName: string;
|
||||
}
|
||||
export interface GlobEnvConfig {
|
||||
// Site title
|
||||
VITE_GLOB_APP_TITLE: string;
|
||||
// Service interface url
|
||||
VITE_GLOB_API_URL: string;
|
||||
// Service interface url prefix
|
||||
VITE_GLOB_API_URL_PREFIX?: string;
|
||||
// Project abbreviation
|
||||
VITE_GLOB_APP_SHORT_NAME: string;
|
||||
// Upload url
|
||||
VITE_GLOB_UPLOAD_URL?: string;
|
||||
}
|
||||
|
188
types/global.d.ts
vendored
188
types/global.d.ts
vendored
@ -1,96 +1,92 @@
|
||||
import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue';
|
||||
|
||||
declare global {
|
||||
const __APP_INFO__: {
|
||||
pkg: {
|
||||
name: string;
|
||||
version: string;
|
||||
dependencies: Recordable<string>;
|
||||
devDependencies: Recordable<string>;
|
||||
};
|
||||
lastBuildTime: string;
|
||||
};
|
||||
// declare interface Window {
|
||||
// // Global vue app instance
|
||||
// __APP__: App<Element>;
|
||||
// }
|
||||
|
||||
// vue
|
||||
declare type PropType<T> = VuePropType<T>;
|
||||
declare type VueNode = VNodeChild | JSX.Element;
|
||||
|
||||
export type Writable<T> = {
|
||||
-readonly [P in keyof T]: T[P];
|
||||
};
|
||||
|
||||
declare type Nullable<T> = T | null;
|
||||
declare type NonNullable<T> = T extends null | undefined ? never : T;
|
||||
declare type Recordable<T = any> = Record<string, T>;
|
||||
declare type ReadonlyRecordable<T = any> = {
|
||||
readonly [key: string]: T;
|
||||
};
|
||||
declare type Indexable<T = any> = {
|
||||
[key: string]: T;
|
||||
};
|
||||
declare type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
declare type TimeoutHandle = ReturnType<typeof setTimeout>;
|
||||
declare type IntervalHandle = ReturnType<typeof setInterval>;
|
||||
|
||||
declare interface ChangeEvent extends Event {
|
||||
target: HTMLInputElement;
|
||||
}
|
||||
|
||||
declare interface WheelEvent {
|
||||
path?: EventTarget[];
|
||||
}
|
||||
interface ImportMetaEnv extends ViteEnv {
|
||||
__: unknown;
|
||||
}
|
||||
|
||||
declare interface ViteEnv {
|
||||
VITE_PORT: number;
|
||||
VITE_USE_MOCK: boolean;
|
||||
VITE_USE_PWA: boolean;
|
||||
VITE_PUBLIC_PATH: string;
|
||||
VITE_PROXY: [string, string][];
|
||||
VITE_GLOB_APP_TITLE: string;
|
||||
VITE_GLOB_APP_SHORT_NAME: string;
|
||||
VITE_USE_CDN: boolean;
|
||||
VITE_DROP_CONSOLE: boolean;
|
||||
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
|
||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
|
||||
VITE_LEGACY: boolean;
|
||||
VITE_USE_IMAGEMIN: boolean;
|
||||
VITE_GENERATE_UI: string;
|
||||
}
|
||||
|
||||
declare function parseInt(s: string | number, radix?: number): number;
|
||||
|
||||
declare function parseFloat(string: string | number): number;
|
||||
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
type Element = VNode;
|
||||
// tslint:disable no-empty-interface
|
||||
type ElementClass = ComponentRenderProxy;
|
||||
interface ElementAttributesProperty {
|
||||
$props: any;
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface AnyObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
declare module 'vue' {
|
||||
export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
|
||||
}
|
||||
import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue';
|
||||
|
||||
declare global {
|
||||
const __APP_INFO__: {
|
||||
pkg: {
|
||||
name: string;
|
||||
version: string;
|
||||
dependencies: Recordable<string>;
|
||||
devDependencies: Recordable<string>;
|
||||
};
|
||||
lastBuildTime: string;
|
||||
};
|
||||
// declare interface Window {
|
||||
// // Global vue app instance
|
||||
// __APP__: App<Element>;
|
||||
// }
|
||||
|
||||
// vue
|
||||
declare type PropType<T> = VuePropType<T>;
|
||||
declare type VueNode = VNodeChild | JSX.Element;
|
||||
|
||||
export type Writable<T> = {
|
||||
-readonly [P in keyof T]: T[P];
|
||||
};
|
||||
|
||||
declare type Nullable<T> = T | null;
|
||||
declare type NonNullable<T> = T extends null | undefined ? never : T;
|
||||
declare type Recordable<T = any> = Record<string, T>;
|
||||
declare type ReadonlyRecordable<T = any> = {
|
||||
readonly [key: string]: T;
|
||||
};
|
||||
declare type Indexable<T = any> = {
|
||||
[key: string]: T;
|
||||
};
|
||||
declare type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
declare type TimeoutHandle = ReturnType<typeof setTimeout>;
|
||||
declare type IntervalHandle = ReturnType<typeof setInterval>;
|
||||
|
||||
declare interface ChangeEvent extends Event {
|
||||
target: HTMLInputElement;
|
||||
}
|
||||
|
||||
declare interface WheelEvent {
|
||||
path?: EventTarget[];
|
||||
}
|
||||
interface ImportMetaEnv extends ViteEnv {
|
||||
__: unknown;
|
||||
}
|
||||
|
||||
declare interface ViteEnv {
|
||||
VITE_PORT: number;
|
||||
VITE_USE_MOCK: boolean;
|
||||
VITE_USE_PWA: boolean;
|
||||
VITE_PUBLIC_PATH: string;
|
||||
VITE_PROXY: [string, string][];
|
||||
VITE_GLOB_APP_TITLE: string;
|
||||
VITE_GLOB_APP_SHORT_NAME: string;
|
||||
VITE_USE_CDN: boolean;
|
||||
VITE_DROP_CONSOLE: boolean;
|
||||
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
|
||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
|
||||
VITE_LEGACY: boolean;
|
||||
VITE_USE_IMAGEMIN: boolean;
|
||||
VITE_GENERATE_UI: string;
|
||||
}
|
||||
|
||||
declare function parseInt(s: string | number, radix?: number): number;
|
||||
|
||||
declare function parseFloat(string: string | number): number;
|
||||
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
type Element = VNode;
|
||||
// tslint:disable no-empty-interface
|
||||
type ElementClass = ComponentRenderProxy;
|
||||
interface ElementAttributesProperty {
|
||||
$props: any;
|
||||
}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
interface IntrinsicAttributes {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'vue' {
|
||||
export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
|
||||
}
|
||||
|
54
types/index.d.ts
vendored
54
types/index.d.ts
vendored
@ -1,27 +1,27 @@
|
||||
declare interface Fn<T = any, R = T> {
|
||||
(...arg: T[]): R;
|
||||
}
|
||||
|
||||
declare interface PromiseFn<T = any, R = T> {
|
||||
(...arg: T[]): Promise<R>;
|
||||
}
|
||||
|
||||
declare type RefType<T> = T | null;
|
||||
|
||||
declare type LabelValueOptions = {
|
||||
label: string;
|
||||
value: any;
|
||||
[key: string]: string | number | boolean;
|
||||
}[];
|
||||
|
||||
declare type EmitType = (event: string, ...args: any[]) => void;
|
||||
|
||||
declare type TargetContext = '_self' | '_blank';
|
||||
|
||||
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||
$el: T;
|
||||
}
|
||||
|
||||
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
|
||||
|
||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||
declare interface Fn<T = any, R = T> {
|
||||
(...arg: T[]): R;
|
||||
}
|
||||
|
||||
declare interface PromiseFn<T = any, R = T> {
|
||||
(...arg: T[]): Promise<R>;
|
||||
}
|
||||
|
||||
declare type RefType<T> = T | null;
|
||||
|
||||
declare type LabelValueOptions = {
|
||||
label: string;
|
||||
value: any;
|
||||
[key: string]: string | number | boolean;
|
||||
}[];
|
||||
|
||||
declare type EmitType = (event: string, ...args: any[]) => void;
|
||||
|
||||
declare type TargetContext = '_self' | '_blank';
|
||||
|
||||
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||
$el: T;
|
||||
}
|
||||
|
||||
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null;
|
||||
|
||||
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>;
|
||||
|
32
types/module.d.ts
vendored
32
types/module.d.ts
vendored
@ -1,16 +1,16 @@
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue';
|
||||
const Component: DefineComponent<{}, {}, any>;
|
||||
export default Component;
|
||||
}
|
||||
|
||||
declare module 'ant-design-vue/es/locale/*' {
|
||||
import { Locale } from 'ant-design-vue/types/locale-provider';
|
||||
const locale: Locale & ReadonlyRecordable;
|
||||
export default locale as Locale & ReadonlyRecordable;
|
||||
}
|
||||
|
||||
declare module 'virtual:*' {
|
||||
const result: any;
|
||||
export default result;
|
||||
}
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue';
|
||||
const Component: DefineComponent<{}, {}, any>;
|
||||
export default Component;
|
||||
}
|
||||
|
||||
declare module 'ant-design-vue/es/locale/*' {
|
||||
import { Locale } from 'ant-design-vue/types/locale-provider';
|
||||
const locale: Locale & ReadonlyRecordable;
|
||||
export default locale as Locale & ReadonlyRecordable;
|
||||
}
|
||||
|
||||
declare module 'virtual:*' {
|
||||
const result: any;
|
||||
export default result;
|
||||
}
|
||||
|
96
types/store.d.ts
vendored
96
types/store.d.ts
vendored
@ -1,48 +1,48 @@
|
||||
import { ErrorTypeEnum } from '/@/enums/exceptionEnum';
|
||||
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
||||
import { RoleInfo } from '/@/api/sys/model/userModel';
|
||||
|
||||
// Lock screen information
|
||||
export interface LockInfo {
|
||||
// Password required
|
||||
pwd?: string | undefined;
|
||||
// Is it locked?
|
||||
isLock?: boolean;
|
||||
}
|
||||
|
||||
// Error-log information
|
||||
export interface ErrorLogInfo {
|
||||
// Type of error
|
||||
type: ErrorTypeEnum;
|
||||
// Error file
|
||||
file: string;
|
||||
// Error name
|
||||
name?: string;
|
||||
// Error message
|
||||
message: string;
|
||||
// Error stack
|
||||
stack?: string;
|
||||
// Error detail
|
||||
detail: string;
|
||||
// Error url
|
||||
url: string;
|
||||
// Error time
|
||||
time?: string;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
userId: string | number;
|
||||
username: string;
|
||||
realName: string;
|
||||
avatar: string;
|
||||
desc?: string;
|
||||
homePath?: string;
|
||||
roles: RoleInfo[];
|
||||
}
|
||||
|
||||
export interface BeforeMiniState {
|
||||
menuCollapsed?: boolean;
|
||||
menuSplit?: boolean;
|
||||
menuMode?: MenuModeEnum;
|
||||
menuType?: MenuTypeEnum;
|
||||
}
|
||||
import { ErrorTypeEnum } from '/@/enums/exceptionEnum';
|
||||
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
||||
import { RoleInfo } from '/@/api/sys/model/userModel';
|
||||
|
||||
// Lock screen information
|
||||
export interface LockInfo {
|
||||
// Password required
|
||||
pwd?: string | undefined;
|
||||
// Is it locked?
|
||||
isLock?: boolean;
|
||||
}
|
||||
|
||||
// Error-log information
|
||||
export interface ErrorLogInfo {
|
||||
// Type of error
|
||||
type: ErrorTypeEnum;
|
||||
// Error file
|
||||
file: string;
|
||||
// Error name
|
||||
name?: string;
|
||||
// Error message
|
||||
message: string;
|
||||
// Error stack
|
||||
stack?: string;
|
||||
// Error detail
|
||||
detail: string;
|
||||
// Error url
|
||||
url: string;
|
||||
// Error time
|
||||
time?: string;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
userId: string | number;
|
||||
username: string;
|
||||
realName: string;
|
||||
avatar: string;
|
||||
desc?: string;
|
||||
homePath?: string;
|
||||
roles: RoleInfo[];
|
||||
}
|
||||
|
||||
export interface BeforeMiniState {
|
||||
menuCollapsed?: boolean;
|
||||
menuSplit?: boolean;
|
||||
menuMode?: MenuModeEnum;
|
||||
menuType?: MenuTypeEnum;
|
||||
}
|
||||
|
10
types/utils.d.ts
vendored
10
types/utils.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
|
||||
export type DynamicProps<T> = {
|
||||
[P in keyof T]: Ref<T[P]> | T[P] | ComputedRef<T[P]>;
|
||||
};
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
|
||||
export type DynamicProps<T> = {
|
||||
[P in keyof T]: Ref<T[P]> | T[P] | ComputedRef<T[P]>;
|
||||
};
|
||||
|
90
types/vue-router.d.ts
vendored
90
types/vue-router.d.ts
vendored
@ -1,45 +1,45 @@
|
||||
export {};
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends Record<string | number | symbol, unknown> {
|
||||
orderNo?: number;
|
||||
// title
|
||||
title: string;
|
||||
// dynamic router level.
|
||||
dynamicLevel?: number;
|
||||
// dynamic router real route path (For performance).
|
||||
realPath?: string;
|
||||
// Whether to ignore permissions
|
||||
ignoreAuth?: boolean;
|
||||
// role info
|
||||
roles?: RoleEnum[];
|
||||
// Whether not to cache
|
||||
ignoreKeepAlive?: boolean;
|
||||
// Is it fixed on tab
|
||||
affix?: boolean;
|
||||
// icon on tab
|
||||
icon?: string;
|
||||
frameSrc?: string;
|
||||
// current page transition
|
||||
transitionName?: string;
|
||||
// Whether the route has been dynamically added
|
||||
hideBreadcrumb?: boolean;
|
||||
// Hide submenu
|
||||
hideChildrenInMenu?: boolean;
|
||||
// Carrying parameters
|
||||
carryParam?: boolean;
|
||||
// Used internally to mark single-level menus
|
||||
single?: boolean;
|
||||
// Currently active menu
|
||||
currentActiveMenu?: string;
|
||||
// Never show in tab
|
||||
hideTab?: boolean;
|
||||
// Never show in menu
|
||||
hideMenu?: boolean;
|
||||
isLink?: boolean;
|
||||
// only build for Menu
|
||||
ignoreRoute?: boolean;
|
||||
// Hide path for children
|
||||
hidePathForChildren?: boolean;
|
||||
}
|
||||
}
|
||||
export {};
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta extends Record<string | number | symbol, unknown> {
|
||||
orderNo?: number;
|
||||
// title
|
||||
title: string;
|
||||
// dynamic router level.
|
||||
dynamicLevel?: number;
|
||||
// dynamic router real route path (For performance).
|
||||
realPath?: string;
|
||||
// Whether to ignore permissions
|
||||
ignoreAuth?: boolean;
|
||||
// role info
|
||||
roles?: RoleEnum[];
|
||||
// Whether not to cache
|
||||
ignoreKeepAlive?: boolean;
|
||||
// Is it fixed on tab
|
||||
affix?: boolean;
|
||||
// icon on tab
|
||||
icon?: string;
|
||||
frameSrc?: string;
|
||||
// current page transition
|
||||
transitionName?: string;
|
||||
// Whether the route has been dynamically added
|
||||
hideBreadcrumb?: boolean;
|
||||
// Hide submenu
|
||||
hideChildrenInMenu?: boolean;
|
||||
// Carrying parameters
|
||||
carryParam?: boolean;
|
||||
// Used internally to mark single-level menus
|
||||
single?: boolean;
|
||||
// Currently active menu
|
||||
currentActiveMenu?: string;
|
||||
// Never show in tab
|
||||
hideTab?: boolean;
|
||||
// Never show in menu
|
||||
hideMenu?: boolean;
|
||||
isLink?: boolean;
|
||||
// only build for Menu
|
||||
ignoreRoute?: boolean;
|
||||
// Hide path for children
|
||||
hidePathForChildren?: boolean;
|
||||
}
|
||||
}
|
||||
|
54
yarn.lock
54
yarn.lock
@ -919,37 +919,37 @@
|
||||
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-3.0.1.tgz#b6af8f782485374bbb5fe09edf067a845bf4caae"
|
||||
integrity sha512-Ll9JgxG7ONIz/XZv3dssfoMUDu9qAnlJ+km+pBA0teYSXzwPCIzS/e1bmwNYl5dcQGs677D21amgfYAnzMl17A==
|
||||
|
||||
"@volar/code-gen@0.38.8":
|
||||
version "0.38.8"
|
||||
resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.8.tgz#ea50a742983f9fd8c3fc23d61497387c520776c9"
|
||||
integrity sha512-e37jd+JwNjBpWiBblsdmYMbJ9bELiuj2yZrsXv1IVKpYNSfvS92ZiYjJqVXHUwpzNeZjFG0RCd5nTpbiebwANw==
|
||||
"@volar/code-gen@0.38.9":
|
||||
version "0.38.9"
|
||||
resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.9.tgz#8fed2c6a472c8f11ce695b08789bcc22b08e7fa6"
|
||||
integrity sha512-n6LClucfA+37rQeskvh9vDoZV1VvCVNy++MAPKj2dT4FT+Fbmty/SDQqnsEBtdEe6E3OQctFvA/IcKsx3Mns0A==
|
||||
dependencies:
|
||||
"@volar/source-map" "0.38.8"
|
||||
"@volar/source-map" "0.38.9"
|
||||
|
||||
"@volar/source-map@0.38.8":
|
||||
version "0.38.8"
|
||||
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.8.tgz#13b2fc9234f78fada3c78fd235f446cfaaa7d0b8"
|
||||
integrity sha512-JZvpjW/z2U3wq5wvwcTounPrRAZuSl4hlVKr3y7y72bKr++6W05OnX7fl/ddw39G/wLHdI2ag5+4JWsSd/EYhg==
|
||||
"@volar/source-map@0.38.9":
|
||||
version "0.38.9"
|
||||
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.9.tgz#935d6def4b4342e8e2d63cd8e6bf9bf1155c58d8"
|
||||
integrity sha512-ba0UFoHDYry+vwKdgkWJ6xlQT+8TFtZg1zj9tSjj4PykW1JZDuM0xplMotLun4h3YOoYfY9K1huY5gvxmrNLIw==
|
||||
|
||||
"@volar/vue-code-gen@0.38.8":
|
||||
version "0.38.8"
|
||||
resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.8.tgz#e7b719194ef40d76093191cf4bb83c96134fed32"
|
||||
integrity sha512-iQVNmIu1TqnqTko+l9yeylmZipZ8zNH20XZAK9+48hkv2fEQnnJn5AI2W9Zb2M5DkGMpbYiJk9Fq1vm51YY1+g==
|
||||
"@volar/vue-code-gen@0.38.9":
|
||||
version "0.38.9"
|
||||
resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.9.tgz#878f00fec82a2fc300396d70e26b0ea29952f740"
|
||||
integrity sha512-tzj7AoarFBKl7e41MR006ncrEmNPHALuk8aG4WdDIaG387X5//5KhWC5Ff3ZfB2InGSeNT+CVUd74M0gS20rjA==
|
||||
dependencies:
|
||||
"@volar/code-gen" "0.38.8"
|
||||
"@volar/source-map" "0.38.8"
|
||||
"@volar/code-gen" "0.38.9"
|
||||
"@volar/source-map" "0.38.9"
|
||||
"@vue/compiler-core" "^3.2.37"
|
||||
"@vue/compiler-dom" "^3.2.37"
|
||||
"@vue/shared" "^3.2.37"
|
||||
|
||||
"@volar/vue-typescript@0.38.8":
|
||||
version "0.38.8"
|
||||
resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.8.tgz#5412a8b38d404a72aa37902ad87ccd3dc0c7f1f1"
|
||||
integrity sha512-7WeFt5piz9I6FKw2cQQCWm+75MxS6xCOGm300iu+hJORlroN2dwWbwj97pQnDGbjQbftCRplUYf0GqmhcOsanQ==
|
||||
"@volar/vue-typescript@0.38.9":
|
||||
version "0.38.9"
|
||||
resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.9.tgz#e5dfdc6f0d6dbea683647cd477fafbd483983b35"
|
||||
integrity sha512-iJMQGU91ADi98u8V1vXd2UBmELDAaeSP0ZJaFjwosClQdKlJQYc6MlxxKfXBZisHqfbhdtrGRyaryulnYtliZw==
|
||||
dependencies:
|
||||
"@volar/code-gen" "0.38.8"
|
||||
"@volar/source-map" "0.38.8"
|
||||
"@volar/vue-code-gen" "0.38.8"
|
||||
"@volar/code-gen" "0.38.9"
|
||||
"@volar/source-map" "0.38.9"
|
||||
"@volar/vue-code-gen" "0.38.9"
|
||||
"@vue/compiler-sfc" "^3.2.37"
|
||||
"@vue/reactivity" "^3.2.37"
|
||||
|
||||
@ -7822,12 +7822,12 @@ vue-router@^4.1.2:
|
||||
dependencies:
|
||||
"@vue/devtools-api" "^6.1.4"
|
||||
|
||||
vue-tsc@^0.38.8:
|
||||
version "0.38.8"
|
||||
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.8.tgz#becf3dddd3c57784c79206aa1d5be750e8bca319"
|
||||
integrity sha512-hhyc5SODiekcYNXG08aNg17LogR19o3i14avVejo+Fm45Dqk9Ke6rb0M19HoTKdQGfZBgqg2VUboYxmtAukWeg==
|
||||
vue-tsc@^0.38.9:
|
||||
version "0.38.9"
|
||||
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.9.tgz#9e945937667f704325328db8af1cc6bc7314b85e"
|
||||
integrity sha512-Yoy5phgvGqyF98Fb4mYqboR4Q149jrdcGv5kSmufXJUq++RZJ2iMVG0g6zl+v3t4ORVWkQmRpsV4x2szufZ0LQ==
|
||||
dependencies:
|
||||
"@volar/vue-typescript" "0.38.8"
|
||||
"@volar/vue-typescript" "0.38.9"
|
||||
|
||||
vue@^3.2.36:
|
||||
version "3.2.37"
|
||||
|
Loading…
x
Reference in New Issue
Block a user