UNPKG

press-plus

Version:
46 lines (41 loc) 707 B
/** * @module widget/dialog * @description toast组件 */ /** * 小程序版本弹窗 * @example * Dialog.confirm({ * title: '', * message: '', * }) * .then(() => { * resolve(true); * }) * .catch(() => { * resolve(false); * }); * */ function Dialog(options: any) { const { title = '', message = '', content = '', } = options; return new Promise((resolve, reject) => { uni.showModal({ title, content: message || content, success(res: any = {}) { if (res.confirm) { resolve(1); } else if (res.cancel) { reject(); } }, }); }); } Dialog.confirm = Dialog; export { Dialog };