import Vue from 'vue'; import VueRouter from 'vue-router'; import VueI18n from 'vue-i18n' Vue.use(VueRouter); Vue.use(VueI18n); import { messages, defaultLocale } from './lang/i18n'; var locale = window.location.pathname.replace(/^\/([^\/]+).*/i,'$1'); const i18n = new VueI18n({ locale: (locale.trim().length && locale != "/") ? locale : defaultLocale , fallbackLocale: 'en', messages }) const routes = [ { path: '/', component: require('./components/home/home.vue.html') }, { path: '/product', component: require('./components/product/product.vue.html') }, ]; const router = new VueRouter({ base: (locale.trim().length && locale != "/") ? '/' + locale : undefined, mode: 'history', routes: routes }); new Vue({ el: '#app-root', router: router, i18n: i18n, render: h => h(require('./components/app/app.vue.html')) });
Обсуждают сегодня