import Vue from 'vue'
import Detail from './detail.vue';
import i18n from '@/util/lang/lang'

const detailConstructor = Vue.extend(Detail)

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

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

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

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

export default Detail




