import * as lControl from './control.js'; import * as lTool from './tool.js'; import * as lDom from './dom.js'; export { lControl as control, lTool as tool, lDom as dom }; /** --- vue 对象 --- */ export declare let vue: IVueObject; /** --- pointer 对象 --- */ export declare let pointer: typeof import('@litert/pointer'); /** --- vue-router 的 router 实例 --- */ export declare let router: IRouter | undefined; /** --- 总大页面 --- */ export declare abstract class AbstractPage { /** --- 系统当前语言 --- */ private readonly _locale; /** --- 获取系统当前语言 --- */ get locale(): string; /** --- 语言包路径,为空则没有加载前端语言包 --- */ private readonly _localePath; /** --- 获取语言包路径,可能为空 --- */ get localePath(): string; constructor(opt: { /** --- 设定当前的程序语言 --- */ 'locale'?: string; /** --- 设定语言包所在路径,无所谓是否 / 结尾 --- */ 'localePath'?: string; }); /** --- 入口方法,会阻塞加载进程 --- */ abstract main(): void | Promise; /** --- 完全加载完成后执行,不会阻塞加载进程 --- */ onReady(): void | Promise; onBeforeUpdate(): void | Promise; onUpdated(): void | Promise; onBeforeUnmount(): void | Promise; onUnmounted(): void | Promise; /** * --- 获取 refs 情况 --- */ get refs(): Record>; /** * --- 等待渲染 --- */ get nextTick(): () => Promise; /** * --- 获取语言内容 --- */ get l(): (key: string, data?: string[]) => string; /** * --- 监视变动 --- * @param name 监视的属性 * @param cb 回调 * @param opt 参数 */ watch(name: TK | (() => TR), cb: (val: T[TK] & TR, old: T[TK] & TR) => void | Promise, opt?: { 'immediate'?: boolean; 'deep'?: boolean; }): () => void; /** --- dialog 信息 --- */ dialogInfo: { 'show': boolean; 'title': string; 'content': string; 'buttons': string[]; select?: (button: string) => void | Promise; }; /** --- 弹出一个框框 --- */ dialog(opt: string | IDialogOptions): Promise; /** --- 验证码窗口 --- */ captchaInfo: { 'show': boolean; 'now': string; 'objects': Record void; 'instance': any; }>; }; /** * --- 弹出验证码确认框,确认后可立即提交,可用于登录、发验证码按钮等地方 --- * --- 请勿开启 loading --- * @param opt 参数 * @returns 验证是否通过 */ showCaptcha(opt: IShowCaptchaOptions): Promise; /** --- 仅 CF 模式会调用 --- */ hideCaptcha(): void; /** --- 弹出一个询问框 --- */ confirm(opt: string | IConfirmOptions): Promise; /** --- 底部弹出提示框 --- */ alertInfo: { show: boolean; content: string; timer: number; type: string; }; /** --- 显示一个 alert,支持 html,请注意传入内容的安全 --- */ alert(content: string, type?: 'default' | 'primary' | 'info' | 'warning' | 'danger' | 'pe'): void; /** --- 整个窗口的宽度 --- */ windowWidth: number; /** --- 整个窗口的高度 --- */ windowHeight: number; /** --- 窗口宽度是否小于等于 800 像素 --- */ get narrow(): boolean; /** --- 是否显示加载框 --- */ loading: boolean; /** --- 滚动到顶部 --- */ toTop(): void; /** --- 显示 lnav --- */ showLnav(): void; /** * --- 获取 vue-router 的当前路由信息,需要开启 router --- */ get routeInfo(): IRouteInfo | undefined; /** * --- 路由导航跳转,需要开启 router --- * @param to 目标路由 */ routerPush(to: string | IRouteLocation): Promise | undefined; /** * --- 路由导航替换(不留历史记录),需要开启 router --- * @param to 目标路由 */ routerReplace(to: string | IRouteLocation): Promise | undefined; /** * --- 路由后退 --- */ routerBack(): void; /** * --- 路由前进 --- */ routerForward(): void; } /** --- 大页面的内嵌页面 --- */ export declare abstract class AbstractPanel { /** --- 入口方法 --- */ abstract main(): void | Promise; onBeforeUnmount(): void | Promise; onUnmounted(): void | Promise; /** --- 获取总大页面对象 --- */ rootPage: AbstractPage & Record; /** * --- 获取语言内容 --- */ get l(): (key: string, data?: string[]) => string; /** * --- 获取 refs 情况 --- */ get refs(): Record>; /** * --- 等待渲染 --- */ get nextTick(): () => Promise; /** * --- 监视变动 --- * @param name 监视的属性 * @param cb 回调 * @param opt 参数 */ watch(name: TK | (() => TR), cb: (val: T[TK] & TR, old: T[TK] & TR) => void | Promise, opt?: { 'immediate'?: boolean; 'deep'?: boolean; }): () => void; /** * --- 获取 vue-router 的当前路由信息,需要开启 router --- */ get routeInfo(): IRouteInfo | undefined; } /** * --- 将 AbstractPanel 转为 Vue 路由组件 --- * @param panel Panel 类 * @param template 组件 HTML 模板 */ export declare function routeComponent(panel: new () => AbstractPanel, template: string): Record; /** * --- 异步加载路由页面组件(layout.html + code.js + style.css) --- * @param dir 页面目录的完整 URL,可用 getDirname(import.meta.url) + '/pages/xxx' 获取 * @param code 代码加载函数(可选),如 () => import('./pages/xxx/code.js') */ export declare function routeLoad(dir: string, code?: () => Promise<{ 'default': new () => AbstractPanel; }>): () => Promise>; /** --- 获取当前所在目录(参数留空获取 Purease 所在的目录,不以 / 结尾 --- */ export declare function getDirname(importUrl?: string): string; /** --- 用户定义的全局对象 --- */ export declare let global: any; /** --- 获取当前 cdn 前缀 --- */ export declare function getCdn(): string; /** --- 资源版本号,用于缓存控制 --- */ export declare let version: string; /** --- 获取带版本号的 URL --- */ export declare function getVersionUrl(url: string): string; /** --- 运行当前页面 --- */ export declare function launcher(page: new (opt: { 'locale'?: string; 'localePath'?: string; }) => T, options?: { /** --- 生产环境请不要开启,默认不开启,开启后将加载 debug 版框架 --- */ 'debug'?: boolean; /** --- 设定当前的程序语言 --- */ 'locale'?: string; /** --- 设定语言包所在路径,无所谓是否 / 结尾 --- */ 'localePath'?: string; /** --- 要加载的子 panels --- */ 'panels'?: Array<{ 'selector': string; 'panel': new () => AbstractPanel; }>; /** --- 要加载的模块 --- */ 'modules'?: string[]; /** --- 路由配置,配置后自动加载 vue-router --- */ 'router'?: IRouterOptions; /** --- 资源版本号,用于动态加载资源的缓存控制,如 '1.0.0' --- */ 'version'?: string; }): void; /** * --- 打印调试信息,线上环境不会打印 --- * @param message 参数 * @param optionalParams 参数 */ export declare function debug(message?: any, ...optionalParams: any[]): void; /** * --- 向控制台直接显示内容,一般情况下禁止使用 --- * @param message 参数 * @param optionalParams 参数 */ export declare function display(message?: any, ...optionalParams: any[]): void; /** --- Vue 实例 --- */ export interface IVue { '$attrs': Record; '$data': Record; '$el': HTMLElement; $emit(name: string, ...arg: any): void; $forceUpdate(): void; $nextTick(): Promise; '$options': Record; '$parent': IVue | null; '$props': Record; '$refs': Record; '$root': IVue; '$slots': { 'default': undefined | ((o?: any) => IVNode[]); [key: string]: undefined | ((o?: any) => IVNode[]); }; $watch: (o: any, cb: (n: any, o: any) => void, opt?: { 'immediate'?: boolean; 'deep'?: boolean; }) => void; [key: string]: any; } /** --- Vue 节点 --- */ export interface IVNode { 'children': { 'default': undefined | (() => IVNode[]); [key: string]: undefined | (() => IVNode[]); } & IVNode[]; 'props': Record; 'type': symbol | Record; [key: string]: any; } export interface IVueObject { createApp(opt: any): IVApp; ref(obj: T): { 'value': T; }; reactive(obj: T): T; markRaw(obj: T): T; computed(fn: () => T): { readonly value: T; }; provide(key: string | symbol, value: T): void; inject(key: string | symbol, defaultValue?: T): T; watch(v: any, cb: (n: any, o: any) => void | Promise, opt?: { 'immediate'?: boolean; 'deep'?: boolean; }): void; h(tag: any, props?: Record | null, children?: any): any; resolveComponent(name: string): any; } /** --- Vue 选项合并函数 --- */ export type IVueOptionMergeFunction = (to: unknown, from: unknown, instance: IVue) => any; /** --- Vue 配置 --- */ export interface IVueConfig { errorHandler?(err: unknown, instance: IVue | null, info: string): void; 'globalProperties': Record; isCustomElement(tag: string): boolean; 'optionMergeStrategies': Record; 'performance': boolean; warnHandler?(msg: string, instance: IVue | null, trace: string): void; } /** --- Vue 应用 --- */ export interface IVApp { component(name: string): any | undefined; component(name: string, config: any): this; 'config': IVueConfig; directive(name: string): any | undefined; directive(name: string, config: any): this; mixin(mixin: any): this; use(plugin: any, ...options: any[]): this; mount(rootContainer: HTMLElement | string): IVue; provide(key: string, value: T): this; unmount(): void; 'version': string; ['_container']: HTMLElement; } /** --- Dialog 选项 --- */ export interface IDialogOptions { 'title'?: string; /** --- 支持 html --- */ 'content': string; 'buttons'?: string[]; 'select'?: (button: string) => undefined | boolean | Promise; } /** --- Confirm 选项 --- */ export interface IConfirmOptions { 'title'?: string; /** --- 支持 html --- */ 'content': string; /** --- 是否显示取消按钮,默认不显示 --- */ 'cancel'?: boolean; } /** --- 显示验证码选项 --- */ export interface IShowCaptchaOptions { /** --- 验证码服务商 --- */ 'factory': 'tc' | 'cf'; /** --- 验证码 key --- */ 'akey': string; } /** --- 路由配置选项 --- */ export interface IRouterOptions { /** --- 路由模式,默认 hash --- */ 'mode'?: 'hash' | 'history'; /** --- 基础路径,history 模式下不传则自动从页面 URL 推断 --- */ 'base'?: string; /** --- 路由列表 --- */ 'routes': IRouteOption[]; } /** --- 单条路由选项 --- */ export interface IRouteOption { /** --- 路由路径 --- */ 'path': string; /** --- 路由名称 --- */ 'name'?: string; /** --- Vue 组件对象或异步加载函数,可用 routeComponent() 或 routeLoad() 生成 --- */ 'component'?: Record | (() => Promise>); /** --- 重定向目标 --- */ 'redirect'?: string; /** --- 子路由 --- */ 'children'?: IRouteOption[]; /** --- 路由元信息 --- */ 'meta'?: Record; /** --- 是否将路由参数作为 props 传入组件 --- */ 'props'?: boolean | Record | ((to: any) => Record); } /** --- vue-router 实例 --- */ export interface IRouter { push(to: string | IRouteLocation): Promise; replace(to: string | IRouteLocation): Promise; go(delta: number): void; back(): void; forward(): void; beforeEach(guard: (to: IRouteInfo, from: IRouteInfo, next?: () => void) => any): () => void; afterEach(hook: (to: IRouteInfo, from: IRouteInfo) => any): () => void; 'currentRoute': { 'value': IRouteInfo; }; [key: string]: any; } /** --- 路由跳转目标 --- */ export interface IRouteLocation { 'path'?: string; 'name'?: string; 'params'?: Record; 'query'?: Record; 'hash'?: string; } /** --- 路由信息 --- */ export interface IRouteInfo { 'path': string; 'name'?: string | symbol; 'params': Record; 'query': Record; 'hash': string; 'fullPath': string; 'meta': Record; 'matched': any[]; }