• 封装:elementui之confirm消息提示框、确认提示弹框


    封装: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
  • 相关阅读:
    重复点击的解决方案
    判断window.open的页面是否已经被关
    npm run dev 报错 版本太低
    :after 写三角形 border
    input text 在苹果微信浏览器中有上上阴影
    input实时监听
    pre强制 自动换行
    解决iphone safari上的圆角问题
    ACM: 强化训练-Roads in the North-BFS-树的直径裸题
    ACM: 强化训练-Inversion Sequence-线段树 or STL·vector
  • 原文地址:https://www.cnblogs.com/sunny3158/p/16126635.html
Copyright © 2020-2023  润新知