global.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. exitMiniProgram: (options?: { success?: () => void; fail?: (err: any) => void; complete?: () => void }) => void;
  15. restartMiniProgram: (options?: { path?: string; success?: () => void; fail?: (err: any) => void; complete?: () => void }) => void;
  16. }
  17. /**
  18. * 微信小程序全局对象
  19. * 仅在微信小程序环境中可用
  20. * 使用条件编译指令 #ifdef MP-WEIXIN 确保只在微信小程序环境中使用
  21. */
  22. var wx: Wx;
  23. /**
  24. * 支付宝小程序全局对象
  25. * 仅在支付宝小程序环境中可用
  26. * 使用条件编译指令 #ifdef MP-ALIPAY 确保只在支付宝小程序环境中使用
  27. */
  28. var my: My;
  29. }
  30. declare module 'pinia' {
  31. export interface DefineStoreOptionsBase<S, Store> {
  32. // 声明 persist 配置项
  33. persist?: {
  34. enabled?: boolean
  35. storage?: {
  36. getItem: <T = any>(key: string) => T;
  37. setItem: (key: string, value: any) => void;
  38. }
  39. paths?: string[],
  40. omit?: string[]
  41. }
  42. }
  43. }
  44. declare module "*.vue" {
  45. import type { DefineComponent } from "vue";
  46. const vueComponent: DefineComponent<{}, {}, any>;
  47. export default vueComponent;
  48. }