index.js 599 B

12345678910111213141516171819202122232425262728293031
  1. import Info from './index.vue'
  2. import i18n from '@/util/lang/lang'
  3. Info.install = function (Vue, store) {
  4. const Constructor = Vue.extend(Info)
  5. let instance
  6. Vue.prototype.$showUserInfo = () => {
  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. i18n,
  17. data () {
  18. return {
  19. visible: true
  20. }
  21. }
  22. })
  23. document.body.appendChild(instance.$el)
  24. }
  25. }
  26. export default Info