sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

封装:element-ui之confirm消息提示框、确认提示弹框

src/utils/index.js

  1. /**
  2. * @author 封装 element-ui confirm
  3. * @param text
  4. * @param title
  5. * @param config
  6. * @returns {Promise}
  7. */
  8. export function confirm(text, title = '温磬提示', config = {}) {
  9. return new Promise((resolve, reject) => {
  10. let confirmButtonLoadingClose = () => {
  11. }
  12. let _config = merge({
  13. showCancelButton: true,
  14. closeOnClickModal: false,
  15. center: true
  16. }, config)
  17. let afterCloseResolve = () => {
  18. }
  19. _config.beforeClose = (action, instance, done) => {
  20. if (lodash.isFunction(config.beforeClose)) {
  21. config.beforeClose(action, instance, () => {
  22. })
  23. }
  24. if (lodash.isFunction(config.confirmCallBack)) {
  25. if (action === 'confirm') {
  26. instance.confirmButtonLoading = true
  27. confirmButtonLoadingClose = () => {
  28. instance.confirmButtonLoading = false
  29. }
  30. config.confirmCallBack({
  31. confirmButtonLoadingClose,
  32. close: () => new Promise((resolve, reject) => {
  33. done()
  34. afterCloseResolve = resolve
  35. }),
  36. action
  37. })
  38. } else {
  39. done()
  40. }
  41. }
  42. if (!config.confirmButtonLoading) {
  43. done()
  44. }
  45. }
  46. delete _config.confirmButtonLoading
  47. MessageBox.confirm(text, title, _config).then(_ => {
  48. afterCloseResolve()
  49. resolve()
  50. }).catch(err => {
  51. afterCloseResolve()
  52. reject(err)
  53. })
  54. })
  55. }

订单池: src/views/fhb/temporary/Index.vue

 

提现审核:src/views/withdraw/index.vue

import {copy, dotData, alert, confirm} from '@/utils'

 

 

 

https://blog.csdn.net/qq_37126704/article/details/86701160
posted on 2022-04-10 17:08  sunny123456  阅读(844)  评论(0编辑  收藏  举报