main.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import store from '@/store'
  4. import { h5Router } from '@/router'
  5. import { Loading } from 'element-ui'
  6. import Invite from '@/components/popup/invite'
  7. import Avatar from '@/components/popup/avatar'
  8. import Info from '@/components/popup/userInfo'
  9. import otherInfo from '@/components/popup/otherInfo'
  10. import imgPreview from '@/components/popup/imgPreview'
  11. import packetGet from '@/components/popup/packetGet'
  12. import packetSend from '@/components/popup/packetSend'
  13. import Toast from '@/components/popup/toast'
  14. import VueClipboard from 'vue-clipboard2'
  15. import directive from '@/plugins/directive'
  16. import TWEEN from '@tweenjs/tween.js'
  17. import i18n from '@/util/lang/lang'
  18. // import { register } from 'register-service-worker'
  19. // import { MessageBox } from 'element-ui'
  20. Vue.use(Invite, store)
  21. Vue.use(Avatar, store)
  22. Vue.use(Info, store)
  23. Vue.use(otherInfo, store)
  24. Vue.use(packetGet, store)
  25. Vue.use(packetSend, store)
  26. Vue.use(Toast)
  27. Vue.use(VueClipboard)
  28. Vue.use(directive)
  29. Vue.use(imgPreview)
  30. Vue.use(Loading)
  31. Vue.config.productionTip = false
  32. new Vue({
  33. render: h => h(App),
  34. router: h5Router,
  35. i18n,
  36. store
  37. }).$mount('#app')
  38. // Setup the animation loop.
  39. function animate (time) {
  40. requestAnimationFrame(animate)
  41. TWEEN.update(time)
  42. }
  43. requestAnimationFrame(animate)
  44. //
  45. // if (process.env.NODE_ENV === 'production') {
  46. // let updatefound = false
  47. // register('/dist/sw.js', {
  48. // ready () {
  49. // console.log(
  50. // 'App is being served from cache by a service worker.\n' +
  51. // 'For more details, visit https://goo.gl/AFskqB'
  52. // )
  53. // },
  54. // registered () {
  55. // console.log('Service worker has been registered.')
  56. // },
  57. // cached () {
  58. // console.log('Content has been cached for offline use.')
  59. // },
  60. // updatefound () {
  61. // updatefound = true
  62. // console.log('New content is downloading.')
  63. // },
  64. // updated () {
  65. // if (updatefound) {
  66. // // MessageBox.confirm('新的内容已更新完毕,立即刷新页面?', '提示', {
  67. // // confirmButtonText: '确定',
  68. // // cancelButtonText: '取消'
  69. // // }).then(() => {
  70. // // location.reload() && window.location.reload()
  71. // // }).catch(() => {})
  72. // }
  73. // },
  74. // offline () {
  75. // console.log('No internet connection found. App is running in offline mode.')
  76. // },
  77. // error (error) {
  78. // console.error('Error during service worker registration:', error)
  79. // }
  80. // })
  81. // }