global.d.ts 2.5 KB

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