UNPKG

weapp-vite

Version:

weapp-vite 一个现代化的小程序打包工具

70 lines 3.36 kB
import { ComputedDefinitions, MethodDefinitions, WevuPageLayoutMap } from "wevu"; //#region src/plugins/vue/createWevuComponent.d.ts interface WevuComponentOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> { data?: () => D; computed?: C; methods?: M; watch?: any; setup?: (...args: any[]) => any; setupLifecycle?: 'created' | 'attached'; allowNullPropInput?: boolean; properties?: Record<string, any>; [key: string]: any; } /** * 从 Vue SFC 的 options 创建 wevu 组件 * 同时支持 Vue 2 风格(Options API)与 Vue 3 风格(Composition API) * * 始终使用 defineComponent(其内部会调用小程序的 Component())。 * 在微信小程序中,Component() 可以同时定义页面与组件。 */ declare function createWevuComponent(options: WevuComponentOptions): void; //#endregion //#region src/plugins/vue/nativeLayoutHost.d.ts type LayoutHostContext = Record<string, any>; type LayoutHostResolver = (key: string) => unknown; type LayoutHostEntry = unknown | (() => unknown); interface LayoutHostBridge { context?: LayoutHostContext; keys: string[]; resolveHost: LayoutHostResolver; } interface LayoutHostResolveOptions { context?: LayoutHostContext; interval?: number; retries?: number; } /** * 为当前原生 layout 注册宿主组件,页面可通过 resolveLayoutHost()/waitForLayoutHost() 访问。 */ declare function registerLayoutHosts(hosts: Record<string, LayoutHostEntry> | string[], context?: LayoutHostContext): LayoutHostBridge | null; /** * 移除当前原生 layout 注册的宿主组件。 */ declare function unregisterLayoutHosts(bridge: LayoutHostBridge | null | undefined): boolean; /** * 解析当前页面 layout 内暴露的宿主组件。 */ declare function resolveLayoutHost<T = any>(key: string, options?: LayoutHostResolveOptions): NonNullable<T> | null; /** * 等待当前页面 layout 宿主组件可用。 */ declare function waitForLayoutHost<T = any>(key: string, options?: LayoutHostResolveOptions): Promise<T | null>; //#endregion //#region src/plugins/vue/nativePageLayout.d.ts type ResolveTypedPageLayoutName = keyof WevuPageLayoutMap extends never ? string : Extract<keyof WevuPageLayoutMap, string>; type ResolveTypedPageLayoutProps<Name extends string> = Name extends keyof WevuPageLayoutMap ? WevuPageLayoutMap[Name] : Record<string, any>; declare function setPageLayout(layout: false): void; declare function setPageLayout<Name extends ResolveTypedPageLayoutName>(layout: Name, props?: ResolveTypedPageLayoutProps<Name>): void; //#endregion //#region src/plugins/vue/runtimeMacros.d.ts /** * 说明:Vue 3 风格的 props 声明(用于类型提示) */ declare function defineProps<T extends Record<string, any>>(props: T): T; /** * 说明:Vue 3 风格的 emits 声明(用于类型提示) */ declare function defineEmits<T extends Record<string, any> | string[]>(emits: T): T; //#endregion export { LayoutHostContext as a, LayoutHostResolver as c, unregisterLayoutHosts as d, waitForLayoutHost as f, LayoutHostBridge as i, registerLayoutHosts as l, createWevuComponent as m, defineProps as n, LayoutHostEntry as o, WevuComponentOptions as p, setPageLayout as r, LayoutHostResolveOptions as s, defineEmits as t, resolveLayoutHost as u };