popup.js 1.74 KB
/*
 * @Description: 弹框组件的封装
 * @Autor: renchao
 * @LastEditTime: 2023-09-11 10:38:44
 */
import ywPopup from '@/components/ywPopup/index'
import Popup1 from '@/components/Popup1/index'
/**
 * @description: popupDialog
 * @param {*} title
 * @param {*} url
 * @param {*} params
 * @param {*} width
 * @param {*} isMain
 * @param {*} height
 * @param {*} btnShow
 * @param {*} callback
 * @param {*} cancel
 * @author: renchao
 */
export function popupDialog (title, url, params, width = '75%', isMain, height, btnShow = false, callback, cancel) {
  // Popup.install
  Popup1(title, url, {
    height: height,
    width: width,
    formData: params,
    btnShow: btnShow,
    isMain: isMain,
    cancel: () => {
      cancel()
    },
    confirm: () => {
      callback()
    },
    popupDialog: popupDialog // 将 popupDialog 方法传递给弹框组件
  })
}

/**
 * @description: ywPopupDialog
 * @param {*} title
 * @param {*} url
 * @param {*} params
 * @param {*} width
 * @param {*} isMain
 * @param {*} height
 * @param {*} btnShow
 * @param {*} callback
 * @param {*} cancel
 * @author: renchao
 */
export function ywPopupDialog (title, url, params, width = '75%', isMain, btnShow = true, height, callback, cancel) {
  // Popup.install
  ywPopup(title, url, {
    height: height,
    width: width,
    formData: params,
    btnShow: btnShow,
    isMain: isMain,
    cancel: () => {
      cancel()
    },
    confirm: () => {
      callback()
    },
    popupDialog: ywPopupDialog // 将 popupDialog 方法传递给弹框组件
  })
}

/**
 * @description: popupCacel
 * @author: renchao
 */
export function popupCacel () {
  Popup1().close()
}

/**
 * @description: ywPopupCacel
 * @author: renchao
 */
export function ywPopupCacel () {
  ywPopup().close()
}