UNPKG

agile-core

Version:

Agile Core - A powerful component based micro front-end framework

80 lines (66 loc) 2.18 kB
/// <reference types="vite/client" /> declare module '*.vue' { import type { DefineComponent } from 'vue' const component: DefineComponent<{}, {}, any> export default component } // 为 Vite define 配置的全局变量添加类型声明 declare const __AUI_CONFIG__: { tagPrefix: string; buildTime: string; [key: string]: any; }; declare module '@auicore' { interface Component { name?: string; // 数据和属性 data?: () => Record<string, any>; props?: string[] | Record<string, any>; computed?: Record<string, any>; methods?: Record<string, Function>; watch?: Record<string, any>; // 生命周期钩子 beforeCreate?(): void; created?(): void; beforeMount?(): void; mounted?(): void; beforeUpdate?(): void; updated?(): void; beforeUnmount?(): void; unmounted?(): void; activated?(): void; deactivated?(): void; // 组件选项 components?: Record<string, any>; directives?: Record<string, any>; filters?: Record<string, any>; mixins?: any[]; extends?: any; // 模板选项 template?: string; render?: Function; // AUI 特有的钩子 auiInit?(): void; // 允许任意属性 [key: string]: any; } type HookHandler = (c: Component) => void | Component; export { HookHandler, Component }; interface AuiCoreType { /** * 对现有组件进行hook * @param name 组件完整标签名,比如aui-my-comp * @param handle hook处理函数 */ hookStructure(tagName: string, handle: HookHandler): void; /** * 定义组件,如果force为true,则如果组件已经定义过,则会强制重新定义 * @param v * @param force */ define(v: Component, force?: boolean): Component; // 其他方法可以根据需要添加 } const AuiCore: AuiCoreType; export default AuiCore; }