app.js
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Vue from 'vue';
import App from './app.vue';
import {createRouter} from './router';
import {createStore} from './store';
import 'filters';
import 'directives';
import titleMixin from './mixins/title';
import downloadMixin from './mixins/download';
import pluginCore from './plugins/core';
import lazyload from 'vue-lazyload';
import reportError from 'report-error';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import relativeTime from 'dayjs/plugin/relativeTime';
Vue.use(lazyload, {
preLoad: 3,
loading: 'data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==',
error: 'data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==',
});
Vue.use(pluginCore);
Vue.mixin(titleMixin);
Vue.mixin(downloadMixin);
dayjs.locale('zh-cn');
dayjs.extend(relativeTime);
export function createApp(context, state = {}) {
const router = createRouter();
const store = createStore(context, state);
const app = new Vue({
router,
store,
errorCaptured(error) {
reportError(context, 'server')(error);
return false;
},
render: h => h(App)
});
return {app, router, store};
}