global.d.ts
2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// 申明外部 npm 插件模块
declare module 'splitpanes';
declare module 'js-cookie';
declare module '@wangeditor/editor-for-vue';
declare module 'qs';
// 声明一个模块,防止引入文件时报错
declare module '*.json';
declare module '*.png';
declare module '*.jpg';
declare module '*.scss';
declare module '*.ts';
declare module '*.js';
// 声明文件,*.vue 后缀的文件交给 vue 模块来处理
declare module '*.vue' {
import type { DefineComponent } from 'vue';
const component: DefineComponent<{}, {}, any>;
export default component;
}
// 声明文件,定义全局变量
/* eslint-disable */
declare interface Window {
nextLoading: boolean;
}
// 声明路由当前项类型
declare type RouteItem<T = any> = {
path: string;
name?: string | symbol | undefined | null;
redirect?: string;
k?: T;
meta?: {
title?: string;
isLink?: string;
isHide?: boolean;
isKeepAlive?: boolean;
isAffix?: boolean;
isIframe?: boolean;
roles?: string[];
icon?: string;
isDynamic?: boolean;
isDynamicPath?: string;
isIframeOpen?: string;
loading?: boolean;
};
children: T[];
query?: { [key: string]: T };
params?: { [key: string]: T };
contextMenuClickId?: string | number;
commonUrl?: string;
isFnClick?: boolean;
url?: string;
transUrl?: string;
title?: string;
id?: string | number;
};
// 声明路由 to from
declare interface RouteToFrom<T = any> extends RouteItem {
path?: string;
children?: T[];
}
// 声明路由当前项类型集合
declare type RouteItems<T extends RouteItem = any> = T[];
// 声明 ref
declare type RefType<T = any> = T | null;
// 声明 HTMLElement
declare type HtmlType = HTMLElement | string | undefined | null;
// 申明 children 可选
declare type ChilType<T = any> = {
children?: T[];
};
// 申明 数组
declare type EmptyArrayType<T = any> = T[];
// 申明 对象
declare type EmptyObjectType<T = any> = {
[key: string]: T;
};
// 申明 select option
declare type SelectOptionType = {
value: string | number;
label: string | number;
};
// 鼠标滚轮滚动类型
declare interface WheelEventType extends WheelEvent {
wheelDelta: number;
}
// table 数据格式公共类型
declare interface TableType<T = any> {
total: number;
loading: boolean;
param: {
pageNum: number;
pageSize: number;
[key: string]: T;
};
}