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

69 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-03-06 19:14:41 +08:00
import Modal from './Modal'
2018-03-06 22:53:32 +08:00
import modalConfirm from './confirm'
2018-03-06 19:14:41 +08:00
// export { ActionButtonProps } from './ActionButton'
// export { ModalProps, ModalFuncProps } from './Modal'
2018-03-06 22:53:32 +08:00
const info = function (props) {
2018-03-06 19:14:41 +08:00
const config = {
type: 'info',
iconType: 'info-circle',
okCancel: false,
...props,
}
2018-03-06 22:53:32 +08:00
return modalConfirm(config)
2018-03-06 19:14:41 +08:00
}
2018-03-06 22:53:32 +08:00
const success = function (props) {
2018-03-06 19:14:41 +08:00
const config = {
type: 'success',
iconType: 'check-circle',
okCancel: false,
...props,
}
2018-03-06 22:53:32 +08:00
return modalConfirm(config)
2018-03-06 19:14:41 +08:00
}
2018-03-06 22:53:32 +08:00
const error = function (props) {
2018-03-06 19:14:41 +08:00
const config = {
type: 'error',
iconType: 'close-circle',
2018-03-06 19:14:41 +08:00
okCancel: false,
...props,
}
2018-03-06 22:53:32 +08:00
return modalConfirm(config)
2018-03-06 19:14:41 +08:00
}
2018-03-06 22:53:32 +08:00
const warning = function (props) {
2018-03-06 19:14:41 +08:00
const config = {
type: 'warning',
iconType: 'exclamation-circle',
okCancel: false,
...props,
}
2018-03-06 22:53:32 +08:00
return modalConfirm(config)
2018-03-06 19:14:41 +08:00
}
2018-03-06 22:53:32 +08:00
const warn = warning
2018-03-06 19:14:41 +08:00
2018-03-06 22:53:32 +08:00
const confirm = function (props) {
2018-03-06 19:14:41 +08:00
const config = {
type: 'confirm',
okCancel: true,
...props,
}
2018-03-06 22:53:32 +08:00
return modalConfirm(config)
}
2018-03-07 21:36:15 +08:00
Modal.info = info
Modal.success = success
Modal.error = error
Modal.warning = warning
Modal.warn = warn
Modal.confirm = confirm
2018-03-06 19:14:41 +08:00
/* istanbul ignore next */
Modal.install = function (Vue) {
Vue.component(Modal.name, Modal)
}
2018-03-06 19:14:41 +08:00
export default Modal