index.js 622 B

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