index.js 671 B

123456789101112131415161718192021222324252627282930313233
  1. import otherInfo from './index.vue'
  2. import i18n from '@/util/lang/lang'
  3. otherInfo.install = function (Vue, store, router) {
  4. const Constructor = Vue.extend(otherInfo)
  5. let instance
  6. Vue.prototype.$showOtherInfo = (userId = 0) => {
  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. visible: false,
  21. userId
  22. }
  23. }
  24. })
  25. document.body.appendChild(instance.$el)
  26. }
  27. }
  28. export default otherInfo