global.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. }
  38. declare interface ThemeTypes {
  39. elColorPrimary?: string
  40. leftMenuBorderColor?: string
  41. leftMenuBgColor?: string
  42. leftMenuBgLightColor?: string
  43. leftMenuBgActiveColor?: string
  44. leftMenuCollapseBgActiveColor?: string
  45. leftMenuTextColor?: string
  46. leftMenuTextActiveColor?: string
  47. logoTitleTextColor?: string
  48. logoBorderColor?: string
  49. topHeaderBgColor?: string
  50. topHeaderTextColor?: string
  51. topHeaderHoverColor?: string
  52. topToolBorderColor?: string
  53. }
  54. }