| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import "core-js/modules/es6.promise";
- import "core-js/modules/es6.array.iterator";
- import Vue from 'vue';
- import App from './App.vue';
- import router from './router';
- import mixin from './view/mixin.js';
- import Conf from '../../src/config.json';
- import NutUI from '../../src/nutui';
- // import en from '../../src/locales/lang/en-US';
- // import demoEN from './lang/en-US';
- import * as OfflinePluginRuntime from 'offline-plugin/runtime';
- import './asset/css/common.scss';
- import './asset/img/logo_share.png';
- Vue.config.productionTip = false;
- // Object.assign(en, demoEN);
- // Vue.use(NutUI, {
- // locale: 'en-US',
- // lang: en
- // });
- NutUI.install(Vue);
- //Vue.locale = () => {};
- // const i18n = new VueI18n({
- // locale: 'en-US',
- // messages: {
- // 'en-US': en
- // }
- // });
- // 兼容vue-i18n
- // Vue.locale = () => {};
- // const i18n = new VueI18n({
- // locale: 'en-US',
- // messages: {
- // 'en-US': en
- // }
- // });
- // Vue.prototype.$i18n = i18n;
- // Vue.use(VueI18n);
- Vue.mixin(mixin);
- const app = new Vue({
- el: '#demo',
- router,
- components: { App },
- template: '<App/>'
- });
- OfflinePluginRuntime.install({
- onUpdating: () => {
- console.log('SW Event:', 'onUpdating');
- },
- onUpdateReady: () => {
- console.log('SW Event:', 'onUpdateReady');
- OfflinePluginRuntime.applyUpdate();
- },
- onUpdated: () => {
- console.log('SW Event:', 'onUpdated');
- console.log('PWA缓存有更新,需要刷新页面');
- app.$dialog({
- title: "当前页面有新版本,请刷新",
- noCloseBtn: true,
- noOkBtn: true,
- cancelBtnTxt: "刷新页面",
- closeOnClickModal:false,
- lockBgScroll:true,
- onCancelBtn(){
- window.location.reload();
- }
- });
- //window.location.reload();
- },
- onUpdateFailed: () => {
- console.log('SW Event:', 'onUpdateFailed');
- }
- });
- Vue.prototype.NUTCONF = Conf;
- let pageLoading = app.$toast.loading();
- router.beforeEach((to, from, next) => {
- pageLoading.show();
- next();
- })
- router.beforeResolve((to, from, next) => {
- next();
- });
- router.afterEach((to, from) => {
- pageLoading.hide();
- });
|