123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import Vue from 'vue'
- import App from './App.vue'
- import store from '@/store'
- import { pcRouter } from '@/router'
- import { Loading } from 'element-ui'
- import Invite from '@/components/popup/invite'
- import Avatar from '@/components/popup/avatar'
- import Info from '@/components/popup/userInfo'
- import otherInfo from '@/components/popup/otherInfo'
- import imgPreview from '@/components/popup/imgPreview'
- import packetGet from '@/components/popup/packetGet'
- import packetSend from '@/components/popup/packetSend'
- import Toast from '@/components/popup/toast'
- import VueClipboard from 'vue-clipboard2'
- import TWEEN from '@tweenjs/tween.js'
- import i18n from '@/util/lang/lang'
- // 全局自定义插件
- import '@/plugins/directive'
- Vue.use(Invite, store, pcRouter)
- Vue.use(Avatar, store, i18n)
- Vue.use(Info, store, i18n)
- Vue.use(otherInfo, store, pcRouter)
- Vue.use(packetGet, store)
- Vue.use(packetSend, store)
- Vue.use(Toast)
- Vue.use(VueClipboard)
- Vue.use(imgPreview)
- Vue.use(Loading)
- Vue.config.productionTip = false
- new Vue({
- render: h => h(App),
- store,
- i18n,
- router: pcRouter
- }).$mount('#app')
- // Setup the animation loop.
- function animate (time) {
- requestAnimationFrame(animate)
- TWEEN.update(time)
- }
- requestAnimationFrame(animate)
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.register('/sw.js').then(function (reg) {
- if (reg.installing) {
- console.log('Service worker installing')
- } else if (reg.waiting) {
- console.log('Service worker installed')
- } else if (reg.active) {
- console.log('Service worker active')
- }
- reg.addEventListener('updatefound', function () {
- if (navigator.serviceWorker.controller) {
- var installingWorker = reg.installing
- installingWorker.onstatechange = function () {
- console.log('installingWorker.state:' + installingWorker.state)
- switch (installingWorker.state) {
- case 'installed':
- // MessageBox.confirm('新的内容已更新完毕,立即刷新页面?', '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消'
- // }).then(() => {
- // location.reload()
- // }).catch(() => {})
- break
- case 'redundant':
- break
- default:
- }
- }
- }
- })
- if (navigator.serviceWorker) {
- navigator.serviceWorker.addEventListener('statechange', function (e) {
- console.log('statechange: ', e.target.state)
- })
- }
- }).catch(function (error) {
- // registration failed
- console.log('Registration failed with ' + error)
- })
- }
|