index.js 774 B

123456789101112131415161718192021222324252627282930313233
  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, ext) => {
  7. if (instance) {
  8. document.body.removeChild(instance.$el)
  9. instance = null
  10. }
  11. instance = new Constructor({
  12. el: document.createElement('div'),
  13. router,
  14. computed: {
  15. $store () { return store }
  16. },
  17. i18n,
  18. data () {
  19. return {
  20. inviteType: type, // 弹框邀请类型{1:建群,2:邀请好友进群,3:删除群好友,4:添加群管理,5:转让群主}
  21. ext // 额外数据
  22. }
  23. }
  24. })
  25. document.body.appendChild(instance.$el)
  26. }
  27. }
  28. export default Invite