import Vue from 'vue'
import Vip from './vip.vue'
import i18n from '@/util/lang/lang'

const VipConstructor = Vue.extend(Vip)

Vip.install = function (Vue) {
  // Vue.component(Detail.name, Detail);
}

let instance
Vip.show = () => {
  if (instance) {
    document.body.removeChild(instance.$el)
    instance = null
  }

  instance = new VipConstructor({
    el: document.createElement('div'),
    data () {
      return {
        visible: true
      }
    },
    i18n
  })

  document.body.appendChild(instance.$el)
}

Vip.hide = () => {
  if (instance) {
    instance.visible = false
  }
}

export default Vip
