fixed webpack prod, fixed language prefix negociation in vue-router

This commit is contained in:
2019-06-06 17:37:43 +02:00
parent 082e011fbb
commit f0120ba10b
10 changed files with 1141 additions and 448 deletions

View File

@@ -8,29 +8,44 @@ Vue.use(VueRouter)
// https://www.lullabot.com/articles/decoupled-hard-problems-routing
// We could use aliases to never reload the page on language changement
// BUT beforeupdate is not triggered when push alias instead of path or name
const languages = ['en', 'fr'];
console.log('path aliases', (() => languages.map(l => `/${l}/base`))() );
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
const routes = [
{
name: 'home',
path: basePath,
// path: '/',
// alias: (() => languages.map(l => `/${l}`))(),
component: Home
// components: {
// 'home': Home
// }
},
{
name:'base',
path: `${basePath}base`,
// path: `/base`,
// alias: (() => languages.map(l => `/${l}/base`))(),
component: Base,
// components: {
// 'base': Base
// }
},
// {
// path: '*',
// name: 'notfound',
// components: {
// 'notfound': NotFound
// }
// }
]
export default new VueRouter({
mode: 'history',
routes: [
{
path: '/',
name: 'home',
components: {
'home': Home
}
},
{
path: '/base',
name:'base',
components: {
'base': Base
}
},
// {
// path: '*',
// name: 'notfound',
// components: {
// 'notfound': NotFound
// }
// }
]
routes: routes
})