index.js 605 B

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