index.js 605 B

12345678910111213141516171819202122232425262728293031
  1. import Invite from './index.vue'
  2. import i18n from '@/util/lang/lang'
  3. Invite.install = function (Vue, store) {
  4. const Constructor = Vue.extend(Invite)
  5. let instance
  6. Vue.prototype.$showInvite = () => {
  7. if (instance) {
  8. document.body.removeChild(instance.$el)
  9. instance = null
  10. }
  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. i18n
  22. })
  23. document.body.appendChild(instance.$el)
  24. }
  25. }
  26. export default Invite