index.js 612 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import Vue from 'vue'
  2. import Vip from './vip.vue'
  3. import i18n from '@/util/lang/lang'
  4. const VipConstructor = Vue.extend(Vip)
  5. Vip.install = function (Vue) {
  6. // Vue.component(Detail.name, Detail);
  7. }
  8. let instance
  9. Vip.show = () => {
  10. if (instance) {
  11. document.body.removeChild(instance.$el)
  12. instance = null
  13. }
  14. instance = new VipConstructor({
  15. el: document.createElement('div'),
  16. data () {
  17. return {
  18. visible: true
  19. }
  20. },
  21. i18n
  22. })
  23. document.body.appendChild(instance.$el)
  24. }
  25. Vip.hide = () => {
  26. if (instance) {
  27. instance.visible = false
  28. }
  29. }
  30. export default Vip