global.d.ts 2.5 KB

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