global.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /// <reference types='@dcloudio/types' />
  2. import type { IeTool } from './utils/uni-tool';
  3. // 扩展全局 UniApp.Uni 接口
  4. declare global {
  5. interface Uni {
  6. $ie: IeTool;
  7. $uv: any;
  8. $zp: any;
  9. }
  10. /**
  11. * 微信小程序 API 接口
  12. */
  13. interface Wx {
  14. /**
  15. * 打开浏览器
  16. * @param options - 配置选项
  17. * @param options.url - 要打开的网址
  18. * @param options.success - 成功回调
  19. * @param options.fail - 失败回调
  20. */
  21. openBrowser?: (options: {
  22. url: string;
  23. success?: () => void;
  24. fail?: (err: any) => void;
  25. }) => void;
  26. }
  27. /**
  28. * 支付宝小程序 API 接口
  29. */
  30. interface My {
  31. /**
  32. * 打开浏览器
  33. * @param options - 配置选项
  34. * @param options.url - 要打开的网址
  35. */
  36. openBrowser?: (options: { url: string }) => void;
  37. }
  38. /**
  39. * 微信小程序全局对象
  40. * 仅在微信小程序环境中可用
  41. * 使用条件编译指令 #ifdef MP-WEIXIN 确保只在微信小程序环境中使用
  42. */
  43. var wx: Wx;
  44. /**
  45. * 支付宝小程序全局对象
  46. * 仅在支付宝小程序环境中可用
  47. * 使用条件编译指令 #ifdef MP-ALIPAY 确保只在支付宝小程序环境中使用
  48. */
  49. var my: My;
  50. }
  51. declare module 'pinia' {
  52. export interface DefineStoreOptionsBase<S, Store> {
  53. // 声明 persist 配置项
  54. persist?: {
  55. enabled?: boolean
  56. storage?: {
  57. getItem: <T = any>(key: string) => T;
  58. setItem: (key: string, value: any) => void;
  59. }
  60. paths?: string[],
  61. omit?: string[]
  62. }
  63. }
  64. }
  65. declare module "*.vue" {
  66. import type { DefineComponent } from "vue";
  67. const vueComponent: DefineComponent<{}, {}, any>;
  68. export default vueComponent;
  69. }