src/utils/index.js

/**
 * @author 封装 element-ui confirm
 * @param text
 * @param title
 * @param config
 * @returns {Promise}
 */
export function confirm(text, title = '温磬提示', config = {}) {
  return new Promise((resolve, reject) => {
    let confirmButtonLoadingClose = () => {
    }
    let _config = merge({
      showCancelButton: true,
      closeOnClickModal: false,
      center: true
    }, config)
    let afterCloseResolve = () => {
    }
    _config.beforeClose = (action, instance, done) => {
      if (lodash.isFunction(config.beforeClose)) {
        config.beforeClose(action, instance, () => {
        })
      }
      if (lodash.isFunction(config.confirmCallBack)) {
        if (action === 'confirm') {
          instance.confirmButtonLoading = true
          confirmButtonLoadingClose = () => {
            instance.confirmButtonLoading = false
          }
          config.confirmCallBack({
            confirmButtonLoadingClose,
            close: () => new Promise((resolve, reject) => {
              done()
              afterCloseResolve = resolve
            }),
            action
          })
        } else {
          done()
        }
      }
      if (!config.confirmButtonLoading) {
        done()
      }
    }
    delete _config.confirmButtonLoading
    MessageBox.confirm(text, title, _config).then(_ => {
      afterCloseResolve()
      resolve()
    }).catch(err => {
      afterCloseResolve()
      reject(err)
    })
  })
}

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

 

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

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

 

 

 

GitHub 加速计划 / eleme / element
13
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:30 天前 )
c345bb45 1 年前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 1 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐