global.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. BMAP_SATELLITE_MAP: any
  28. BMap: any
  29. }
  30. // 声明路由当前项类型
  31. declare type RouteItem<T = any> = {
  32. path: string
  33. name?: string | symbol | undefined | null
  34. redirect?: string
  35. k?: T
  36. meta?: {
  37. title?: string
  38. isLink?: string
  39. isHide?: boolean
  40. isKeepAlive?: boolean
  41. isAffix?: boolean
  42. isIframe?: boolean
  43. roles?: string[]
  44. icon?: string
  45. isDynamic?: boolean
  46. isDynamicPath?: string
  47. isIframeOpen?: string
  48. loading?: boolean
  49. isDir?: 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. }