1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import Vue from 'vue'
- import App from './App.vue'
- import store from '@/store'
- // import i18n from '@/util/lang/lang'
- 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 Toast from '@/components/popup/toast'
- import VueClipboard from 'vue-clipboard2'
- import directive from '@/plugins/directive'
- import TWEEN from '@tweenjs/tween.js'
- import { register } from 'register-service-worker'
- import { MessageBox } from 'element-ui'
- Vue.use(Invite, store)
- Vue.use(Avatar, store)
- Vue.use(Info, store)
- Vue.use(otherInfo, store)
- Vue.use(packetGet, store)
- Vue.use(Toast)
- Vue.use(VueClipboard)
- Vue.use(directive)
- Vue.use(imgPreview)
- Vue.config.productionTip = false
- new Vue({
- render: h => h(App),
- store
- // i18n
- }).$mount('#app')
- // Setup the animation loop.
- function animate (time) {
- requestAnimationFrame(animate)
- TWEEN.update(time)
- }
- requestAnimationFrame(animate)
- if (process.env.NODE_ENV === 'production') {
- let updatefound = false
- register('/sw.js', {
- ready () {
- console.log(
- 'App is being served from cache by a service worker.\n' +
- 'For more details, visit https://goo.gl/AFskqB'
- )
- },
- registered () {
- console.log('Service worker has been registered.')
- },
- cached () {
- console.log('Content has been cached for offline use.')
- },
- updatefound () {
- updatefound = true
- console.log('New content is downloading.')
- },
- updated () {
- if (updatefound) {
- MessageBox.confirm('新的内容已更新完毕,立即刷新页面?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- }).then(() => {
- location.reload() && window.location.reload()
- }).catch(() => {})
- }
- },
- offline () {
- console.log('No internet connection found. App is running in offline mode.')
- },
- error (error) {
- console.error('Error during service worker registration:', error)
- }
- })
- }
|