ant-design-vue/components/modal/index.js

69 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import Modal from './Modal';
import modalConfirm from './confirm';
2018-03-06 11:14:41 +00:00
// export { ActionButtonProps } from './ActionButton'
// export { ModalProps, ModalFuncProps } from './Modal'
2019-01-12 03:33:27 +00:00
const info = function(props) {
2018-03-06 11:14:41 +00:00
const config = {
type: 'info',
iconType: 'info-circle',
okCancel: false,
...props,
2019-01-12 03:33:27 +00:00
};
return modalConfirm(config);
};
2018-03-06 11:14:41 +00:00
2019-01-12 03:33:27 +00:00
const success = function(props) {
2018-03-06 11:14:41 +00:00
const config = {
type: 'success',
iconType: 'check-circle',
okCancel: false,
...props,
2019-01-12 03:33:27 +00:00
};
return modalConfirm(config);
};
2018-03-06 11:14:41 +00:00
2019-01-12 03:33:27 +00:00
const error = function(props) {
2018-03-06 11:14:41 +00:00
const config = {
type: 'error',
iconType: 'close-circle',
2018-03-06 11:14:41 +00:00
okCancel: false,
...props,
2019-01-12 03:33:27 +00:00
};
return modalConfirm(config);
};
2018-03-06 11:14:41 +00:00
2019-01-12 03:33:27 +00:00
const warning = function(props) {
2018-03-06 11:14:41 +00:00
const config = {
type: 'warning',
iconType: 'exclamation-circle',
okCancel: false,
...props,
2019-01-12 03:33:27 +00:00
};
return modalConfirm(config);
};
const warn = warning;
2018-03-06 11:14:41 +00:00
2019-01-12 03:33:27 +00:00
const confirm = function(props) {
2018-03-06 11:14:41 +00:00
const config = {
type: 'confirm',
okCancel: true,
...props,
2019-01-12 03:33:27 +00:00
};
return modalConfirm(config);
};
Modal.info = info;
Modal.success = success;
Modal.error = error;
Modal.warning = warning;
Modal.warn = warn;
Modal.confirm = confirm;
2018-03-06 11:14:41 +00:00
/* istanbul ignore next */
2019-01-12 03:33:27 +00:00
Modal.install = function(Vue) {
Vue.component(Modal.name, Modal);
};
2019-01-12 03:33:27 +00:00
export default Modal;