import Vue from 'vue'
// import Depot from 'containers/Modal/DepotModal'
import tagAddItem from '@/views/tagManagement/modal/addItem'
import commentItem from '@/views/commentManagement/modal/item'
import sensitiveItem from '@/views/commentManagement/modal/sensitiveWordItem'
import bannerItem from '@/views/bannerManagement/modal/item'
import accountItem from '@/views/accountManagement/modal/item'
import person from '@/views/accountManagement/modal/person'
import hotWordsItem from '@/views/hotWordsManagement/modal/item'
import recommendItem from '@/views/indexRecommendManagement/modal/item'

const modal = (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 DepotModal = data => {
//   modal(Depot, data)
// }
const tagAddItemModal = data => {
  modal(tagAddItem, data)
}
const commentItemModal = data => {
  modal(commentItem, data)
}
const sensitiveItemModal = data => {
  modal(sensitiveItem, data)
}
const bannerItemModal = data => {
  modal(bannerItem, data)
}
const accountItemModal = data => {
  modal(accountItem, data)
}
const personModal = data => {
  modal(person, data)
}
const hotWordsItemModal = data => {
  modal(hotWordsItem, data)
}
const recommendItemModal = data => {
  modal(recommendItem, data)
}

Vue.prototype.$recommendItemModal = params => {
  recommendItemModal(params)
}
Vue.prototype.$hotWordsItemModal = params => {
  hotWordsItemModal(params)
}
Vue.prototype.$personModal = params => {
  personModal(params)
}
Vue.prototype.$accountItemModal = params => {
  accountItemModal(params)
}
Vue.prototype.$bannerItemModal = params => {
  bannerItemModal(params)
}
Vue.prototype.$sensitiveItemModal = params => {
  sensitiveItemModal(params)
}
Vue.prototype.$commentItemModal = params => {
  commentItemModal(params)
}
Vue.prototype.$tagAddItemModal = params => {
  tagAddItemModal(params)
}
// const showDepotModal = params => {
//   DepotModal(params)
// }
// Vue.prototype.$DepotModal = showDepotModal

// export {
//   showDepotModal
// }
