import Vue from 'vue'
import doctorItem from '@/views/doctorManagement/drawer/item'
import tagItem from '@/views/tagManagement/drawer/item'
import articleItem from '@/views/articleManagement/drawer/item'
import commentArticle from '@/views/articleManagement/drawer/commentInArticle'

const drawer = (Component, props) => {
  let _component = null
  const Instance = new Vue({
    props,
    render(h) {
      return h(Component, {
        props: props,
        on: {
          cancel: () => {
            Instance.$destroy()
            document.body.removeChild(_component.$el)
          }
        }
      })
    }
  })
  _component = Instance.$mount()
  document.body.appendChild(_component.$el)
}

// let Depotdrawer = data => {
//   drawer(Depot, data)
// }
const doctorItemDrawer = data => {
  drawer(doctorItem, data)
}
const tagItemDrawer = data => {
  drawer(tagItem, data)
}
const articleItemDrawer = data => {
  drawer(articleItem, data)
}
const commentArticleDrawer = data => {
  drawer(commentArticle, data)
}

Vue.prototype.$commentArticleDrawer = params => {
  commentArticleDrawer(params)
}
Vue.prototype.$articleItemDrawer = params => {
  articleItemDrawer(params)
}
Vue.prototype.$tagItemDrawer = params => {
  tagItemDrawer(params)
}
Vue.prototype.$doctorItemDrawer = params => {
  doctorItemDrawer(params)
}
// const showDepotModal = params => {
//   DepotModal(params)
// }
// Vue.prototype.$DepotModal = showDepotModal

// export {
//   showDepotModal
// }
