UNPKG

antd-mobile

Version:

<img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*hjjDS5Yy-ooAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />

26 lines (25 loc) 718 B
import { show } from './show'; import { mergeProps } from '../../utils/with-default-props'; import { getDefaultConfig } from '../config-provider'; export function alert(p) { const defaultProps = { confirmText: getDefaultConfig().locale.Modal.ok }; const props = mergeProps(defaultProps, p); return new Promise(resolve => { show(Object.assign(Object.assign({}, props), { closeOnAction: true, actions: [{ key: 'confirm', text: props.confirmText, primary: true }], onAction: props.onConfirm, onClose: () => { var _a; (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props); resolve(); } })); }); }