1 |
|
2 |
|
3 |
|
4 |
|
5 | import Vue from 'vue'
|
6 | import VueRouter from 'vue-router'
|
7 | import { configRouter } from 'utils/configRouter'
|
8 | import RoutedApp from 'components/routed-app'
|
9 | import ElementUI from 'element-ui'
|
10 | import VueI18n from 'vue-i18n'
|
11 |
|
12 | Vue.use(VueI18n)
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | module.exports = function(opts) {
|
20 | const { route, store, el, component, i18n } = opts
|
21 | Vue.use(ElementUI, {
|
22 | i18n: (key, value) => i18n.t(key, value)
|
23 | })
|
24 |
|
25 | if (route) {
|
26 | Vue.use(VueRouter)
|
27 | const transition = route.transition === undefined ? true : !!route.transition
|
28 | configRouter(route).then(router => {
|
29 | const app = new Vue({ template: `<App :animate=${transition}></App>`, components: { App: RoutedApp }, router, store, i18n })
|
30 | app.$mount(el || 'app')
|
31 | })
|
32 | } else {
|
33 |
|
34 | const app = new Vue({ template: '<App/>', components: { App: component }, store, i18n })
|
35 | app.$mount(el || 'app')
|
36 | }
|
37 | }
|