2018-03-19 06:48:05 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import VueI18n from 'vue-i18n';
|
|
|
|
import VueRouter from 'vue-router';
|
|
|
|
import App from './App.vue';
|
|
|
|
import messages from './lang';
|
|
|
|
|
|
|
|
Vue.use(VueI18n);
|
|
|
|
Vue.use(VueRouter);
|
|
|
|
|
|
|
|
const i18n = new VueI18n({
|
|
|
|
locale: navigator.language.split('-')[0],
|
|
|
|
fallbackLocale: 'en',
|
|
|
|
messages: messages
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-03-21 15:51:46 +00:00
|
|
|
const Code = () => import('./route/Code.vue');
|
|
|
|
|
2018-03-19 06:48:05 +00:00
|
|
|
|
|
|
|
const router = new VueRouter({
|
|
|
|
routes: [
|
2018-03-21 15:51:46 +00:00
|
|
|
{ path: '/', component: () => import('./route/Landing.vue'),
|
|
|
|
children: [
|
|
|
|
{ path: 'c/:codeParam', component: Code, props: true },
|
|
|
|
{ path: 'u/:codeParam', component: () => import('./route/Upload.vue'), props: true },
|
|
|
|
{ path: '', component: Code }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{ path: '/admin', component: () => import('./route/admin/Landing.vue'),
|
|
|
|
children: [
|
|
|
|
{ path: 'codes', component: () => import('./route/admin/Codes.vue') },
|
|
|
|
{ path: 'profile', component: () => import('./route/admin/Profile.vue') },
|
|
|
|
{ path: 'users', component: () => import('./route/admin/Users.vue') },
|
|
|
|
{ path: '', component: () => import('./route/admin/Login.vue') }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{ path: '*', redirect: '/' }
|
2018-03-19 06:48:05 +00:00
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
i18n,
|
|
|
|
router,
|
|
|
|
render: h => h(App)
|
|
|
|
});
|