global.d.ts 2.4 KB

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