index.js 868 B

123456789101112131415161718192021222324252627282930313233
  1. import Modal, { destroyFns } from './Modal';
  2. import confirm, { withWarn, withInfo, withSuccess, withError, withConfirm } from './confirm';
  3. function modalWarn(props) {
  4. return confirm(withWarn(props));
  5. }
  6. Modal.info = function infoFn(props) {
  7. return confirm(withInfo(props));
  8. };
  9. Modal.success = function successFn(props) {
  10. return confirm(withSuccess(props));
  11. };
  12. Modal.error = function errorFn(props) {
  13. return confirm(withError(props));
  14. };
  15. Modal.warning = modalWarn;
  16. Modal.warn = modalWarn;
  17. Modal.confirm = function confirmFn(props) {
  18. return confirm(withConfirm(props));
  19. };
  20. Modal.destroyAll = function destroyAllFn() {
  21. while (destroyFns.length) {
  22. var close = destroyFns.pop();
  23. if (close) {
  24. close();
  25. }
  26. }
  27. };
  28. /* istanbul ignore next */
  29. Modal.install = function (app) {
  30. app.component(Modal.name, Modal);
  31. return app;
  32. };
  33. export default Modal;