UNPKG

@minto-ai/mt-ui

Version:

UI组件库

52 lines (51 loc) 1.59 kB
import { Component } from 'vue'; import { DialogProps } from '../../dialog'; /** * PosterOptions 接口定义了 Poster 函数的参数结构。 */ interface PosterOptions { /** * 动态加载的内容组件,返回一个 Promise,解析后包含默认导出的组件对象。 */ component: () => Promise<{ default: Component; }>; /** * 传递给内容组件的属性。 */ props?: Record<string, any>; /** * 传递给内容组件的事件处理函数。 */ events?: Record<string, (...args: Array<any>) => void>; /** * 传递给弹窗组件的属性(不包含 modelValue)。 */ dialogProps?: Partial<Omit<DialogProps, 'modelValue'>>; /** * 传递给弹窗组件的事件处理函数。 */ dialogEvents?: Record<string, (...args: Array<any>) => void>; } /** * PosterReturn 接口定义了 Poster 函数的返回值结构。 */ interface PosterReturn { /** * 关闭弹窗的方法。 */ close: () => void; /** * 动态更新内容组件的属性。 * @param props 新的属性对象。 */ setProps: (props: PosterOptions['props']) => void; } /** * Poster 函数用于动态创建并渲染弹窗。 * @param options PosterOptions 类型的参数,定义了弹窗的内容组件、属性和事件。 * @returns PosterReturn 类型的对象,包含关闭弹窗和更新内容组件属性的方法。 */ declare function Poster(options: PosterOptions): PosterReturn; export default Poster; export type { PosterOptions, PosterReturn, };