# DialogExample **Repository Path**: shareceo/DialogExample ## Basic Information - **Project Name**: DialogExample - **Description**: 提供通用弹窗能力,默认支持AlertDialog,CustomAlertDialog,CustomDialog;提供两种与布局解耦的弹窗模式 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-08-12 - **Last Updated**: 2024-08-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 📚简介 提供通用弹窗能力,默认支持AlertDialog,CustomAlertDialog,CustomDialog;提供两种与布局解耦的弹窗模式 ## 📚使用案例 见 src/main/ets/dialog/DialogExamples.ets ### AlertDialog ```typescript Dialog.showAlertDialog({ ctx: useNav ? Router.pathStack : context, content: "你好,我有一个帽衫".repeat(10), onClose: () => { console.log("onclose") } }) ``` ### CustomAlertDialog ```typescript Dialog.showCustomAlertDialog({ ctx: useNav ? Router.pathStack : context, customView: { builder: wrapBuilder(customDialog2), params: new CustomDialogParams2() }, onConfirm: () => { console.log("onconfirm") }, onCancel: () => { console.log("oncancel") }, onClose: () => { console.log("onclose") } }) ``` ### CustomDialog ```typescript Dialog.showCustomDialog({ ctx: useNav ? Router.pathStack : context, customView: { builder: wrapBuilder(customDialog), params: new CustomDialogParams() }, onClose: () => { console.log('onclose') } }) ```