index.js 584 B

1234567891011121314151617181920212223242526272829
  1. import app_push from './app_push.js'
  2. import h5Push from './h5_push.vue'
  3. const appPush = {
  4. install: function(Vue) {
  5. Vue.prototype.$appPush = function(op = {}) {
  6. // #ifdef APP-PLUS
  7. new app_push({
  8. ...op
  9. }).show();
  10. // #endif
  11. // #ifdef H5
  12. // Vue.component('h5Push', h5Push)
  13. // 创建构造器
  14. const H5PushInstance = Vue.extend(h5Push)
  15. let instance = new H5PushInstance({
  16. data: op
  17. })
  18. instance.$mount()
  19. document.body.appendChild(instance.$el)
  20. Vue.nextTick(() => {
  21. instance.show = true
  22. })
  23. // #endif
  24. }
  25. }
  26. }
  27. export default appPush