@dfeidao/atom-web
Version:
原子操作
37 lines (36 loc) • 1.25 kB
TypeScript
/**
* @module msgbox弹窗
*/
export declare enum ConfirmResult {
YES = "yes",
NO = "no",
CANCEL = "cancel"
}
/**
* 确认提示
* @param content 确认提示
* @param title 提示标题上的文字
* @param yes 确认按钮上的文字
* @param no 取消按钮上的文字
* @param background 背景颜色,默认为:#1890ff
* @return ConfirmResult,可以为’yes’,’no’,’cancel’中的任意一种,用户点击右上角关闭按钮时会返回cancel
* @see [api](https://dfeidao.gitee.io/feidao-web/browser/msgbox)
* @requires 使用本原子操作需要在package.json中devDependencies下加入`"@dfeidao/core":"@version";` @version 为该模块的版本号,可以在[这里](https://feidao-edu.gitee.io/changelogs/)查询
* @example
* ```ts
* import confirm from '@dfeidao/atom-web/msgbox/confirm';
* const flag = await confirm('确定删除吗', '删除', '确定' , '取消', 'red');
* switch (flag) {
* case ConfirmResult.YES:
* // todo
* break;
* case 'no':
* // todo
* break;
* default: // cancel
* // todo
* break;
* }
* ```
*/
export default function confirm(content: string, title: string, yes: string, no: string, background?: string): Promise<ConfirmResult>;