/** * 模块类型声明 */ // uni-app 全局声明 declare const uni: { login(options: { provider: string; success: (res: any) => void; fail: (err: any) => void }): void; request(options: { url: string; method?: string; data?: any; header?: any; timeout?: number; success: (res: any) => void; fail: (err: any) => void }): void; showLoading(options: { title: string; mask?: boolean }): void; hideLoading(): void; showToast(options: { title: string; icon?: string; duration?: number }): void; getStorageSync(key: string): any; setStorageSync(key: string, value: any): void; removeStorageSync(key: string): void; }; // Vite import.meta.env interface ImportMetaEnv { VITE_API_BASE_URL?: string; [key: string]: any; } interface ImportMeta { env: ImportMetaEnv; } // Vue 模块声明 declare module 'vue' { import type { App, DefineComponent, ComponentPublicInstance } from '@vue/runtime-core' export function createSSRApp(component: any): App export function ref(value: T): { value: T } export function reactive(obj: T): T export function computed(fn: () => T): { value: T } export function watch(source: any, cb: any, options?: any): void export function onMounted(fn: () => void): void export function onUnmounted(fn: () => void): void export function nextTick(fn?: () => void): Promise export function defineComponent(component: any): DefineComponent export function provide(key: any, value: any): void export function inject(key: any): any export interface App { config: { globalProperties: Record } use(plugin: any, ...options: any[]): App component(name: string, component: any): App mount(rootContainer: any): ComponentPublicInstance } export interface Plugin { install(app: App, ...options: any[]): void } export type { DefineComponent, ComponentPublicInstance } } // Vue 单文件组件声明 declare module '*.vue' { import type { DefineComponent } from 'vue' const component: DefineComponent<{}, {}, any> export default component } // uview-plus 模块声明 declare module '@/uni_modules/uview-plus' { import type { Plugin } from 'vue' const uviewPlus: Plugin export default uviewPlus } // vite 模块声明 declare module 'vite' { export function defineConfig(config: any): any; } // @dcloudio/vite-plugin-uni declare module '@dcloudio/vite-plugin-uni' { import type { Plugin } from 'vite' function uni(): Plugin export default uni }