Recv/public/src/app.js

46 lines
1.2 KiB
JavaScript

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
});
const Code = () => import('./route/Code.vue');
const router = new VueRouter({
routes: [
{ 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: '/' }
]
});
new Vue({
el: '#app',
i18n,
router,
render: h => h(App)
});