index.js 675 B

12345678910111213141516171819202122232425262728293031323334
  1. import Invite from './index.vue'
  2. import i18n from '@/util/lang/lang'
  3. Invite.install = function (Vue, store, router) {
  4. const Constructor = Vue.extend(Invite)
  5. let instance
  6. Vue.prototype.$showInvite = (type) => {
  7. if (instance) {
  8. document.body.removeChild(instance.$el)
  9. instance = null
  10. }
  11. store.commit('setPopInviteType', type)
  12. instance = new Constructor({
  13. el: document.createElement('div'),
  14. router,
  15. computed: {
  16. $store () { return store }
  17. },
  18. i18n,
  19. data () {
  20. return {
  21. visible: true
  22. }
  23. }
  24. })
  25. document.body.appendChild(instance.$el)
  26. }
  27. }
  28. export default Invite