global.d.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import type { CSSProperties } from 'vue'
  2. import { RawAxiosRequestHeaders } from 'axios'
  3. declare global {
  4. declare interface Fn<T = any> {
  5. (...arg: T[]): T
  6. }
  7. declare type Nullable<T> = T | null
  8. declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
  9. declare type Recordable<T = any, K = string> = Record<K extends null | undefined ? string : K, T>
  10. declare type RemoveReadonly<T> = {
  11. -readonly [P in keyof T]: T[P]
  12. }
  13. declare type ComponentRef<T> = InstanceType<T>
  14. declare type LocaleType = 'zh-CN' | 'en'
  15. declare type TimeoutHandle = ReturnType<typeof setTimeout>
  16. declare type IntervalHandle = ReturnType<typeof setInterval>
  17. declare type ElementPlusInfoType = 'success' | 'info' | 'warning' | 'danger'
  18. declare type LayoutType = 'classic' | 'topLeft' | 'top' | 'cutMenu'
  19. declare type AxiosContentType =
  20. | 'application/json'
  21. | 'application/x-www-form-urlencoded'
  22. | 'multipart/form-data'
  23. | 'text/plain'
  24. declare type AxiosMethod = 'get' | 'post' | 'delete' | 'put'
  25. declare type AxiosResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  26. declare interface AxiosConfig {
  27. params?: any
  28. data?: any
  29. url?: string
  30. method?: AxiosMethod
  31. headers?: RawAxiosRequestHeaders
  32. responseType?: AxiosResponseType
  33. }
  34. declare interface IResponse<T = any> {
  35. code: number
  36. data: T extends any ? T : T & any
  37. success: boolean
  38. message: string
  39. }
  40. declare interface ThemeTypes {
  41. elColorPrimary?: string
  42. leftMenuBorderColor?: string
  43. leftMenuBgColor?: string
  44. leftMenuBgLightColor?: string
  45. leftMenuBgActiveColor?: string
  46. leftMenuCollapseBgActiveColor?: string
  47. leftMenuTextColor?: string
  48. leftMenuTextActiveColor?: string
  49. logoTitleTextColor?: string
  50. logoBorderColor?: string
  51. topHeaderBgColor?: string
  52. topHeaderTextColor?: string
  53. topHeaderHoverColor?: string
  54. topToolBorderColor?: string
  55. }
  56. declare interface ImportMetaEnv {
  57. readonly VITE_NODE_ENV: string
  58. readonly VITE_APP_TITLE: string
  59. readonly VITE_API_BASE_PATH: string
  60. readonly VITE_BASE_PATH: string
  61. readonly VITE_DROP_DEBUGGER: string
  62. readonly VITE_DROP_CONSOLE: string
  63. readonly VITE_SOURCEMAP: string
  64. readonly VITE_OUT_DIR: string
  65. readonly VITE_USE_BUNDLE_ANALYZER: string
  66. readonly VITE_USE_ALL_ELEMENT_PLUS_STYLE: string
  67. readonly VITE_USE_CSS_SPLIT: string
  68. readonly VITE_USE_ONLINE_ICON: string
  69. readonly VITE_ICON_PREFIX: string
  70. readonly VITE_HIDE_GLOBAL_SETTING: string
  71. }
  72. }
  73. // 代码字典的声明
  74. declare interface ICodeItem {
  75. value: string
  76. label: string
  77. }
  78. // 自定义的window全局属性
  79. declare interface Window {
  80. CITY_CODE?: string;
  81. dateRangeProps: Recordable // 根据实际类型调整
  82. APP_FUN_ID: string
  83. }