index.js 637 B

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