index.js 565 Bytes
import Vue from 'vue'
import Popup from './index.vue'

const PopupBox = Vue.extend(Popup)

/**
 * @description: install
 * @param {*} title
 * @param {*} editItem
 * @param {*} data
 * @param {*} formData
 * @author: renchao
 */
Popup.install = function (title, editItem, data, formData) {
  data.title = title
  data.editItem = editItem
  if (formData) {
    data.formData = formData
  }
  let instance = new PopupBox({
    data
  }).$mount()
  document.body.appendChild(instance.$el)
  Vue.nextTick(() => {
    instance.isShow = true
  })
}

export default Popup