index.js 573 B

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