OSDN Git Service

refactor: update code
[bytom/Byone.git] / src / app / index.js
1 import Vue from 'vue'
2 import moment from 'moment'
3 import VueI18n from 'vue-i18n'
4 import Loading from 'vue-loading-overlay'
5 import vuescroll from 'vuescroll/dist/vuescroll-native'
6 import 'vue-loading-overlay/dist/vue-loading.css'
7 import 'vuescroll/dist/vuescroll.css'
8
9 import EntryHome from './entry/home'
10 import EntryWelcome from './entry/welcome'
11 import EntryTransfer from './entry/transfer'
12 import Dialog from '../components/dialog'
13 import vSelect from '../components/select'
14 import MenuPage from '../components/menu-page'
15 import messages, { have } from '../assets/language'
16 import '../assets/style.css'
17
18 Vue.use(VueI18n)
19 const i18n = new VueI18n({
20   fallbackLocale: 'en',
21   locale: have(localStorage.lang) ? localStorage.lang : 'cn',
22   messages
23 })
24 Vue.use(i18n)
25 Vue.use(vuescroll)
26 Vue.use(MenuPage)
27 Vue.use(Loading)
28 Vue.use(Dialog, i18n)
29 Vue.component('v-select', vSelect)
30
31 Vue.prototype.$vuescrollConfig = {
32   mode: 'pure-native',
33   bar: {
34     keepShow: true,
35     background: '#c9c9c9'
36   }
37 }
38
39 Vue.filter('moment', function(value, formatString) {
40   formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
41   return moment(value * 1000).format(formatString)
42 })
43
44 let Application = {}
45
46 Application.welcome = function() {
47   new Vue({
48     el: '#app',
49     i18n: i18n,
50     render: h => h(EntryWelcome)
51   })
52 }
53
54 Application.launth = function() {
55   new Vue({
56     el: '#app',
57     i18n: i18n,
58     render: h => h(EntryHome)
59   })
60 }
61
62 Application.transfer = function() {
63   new Vue({
64     el: '#app',
65     i18n: i18n,
66     render: h => h(EntryTransfer)
67   })
68 }
69
70 export default Application