diff --git a/src/www/components/Layout.vue b/src/www/components/Layout.vue index cb2f41f..ca754c0 100644 --- a/src/www/components/Layout.vue +++ b/src/www/components/Layout.vue @@ -61,6 +61,7 @@ export default { changeCurrent (layout) { this.initWidgetsSources(layout.widgets); this.current = layout; + document.title = layout.title; }, /** diff --git a/src/www/lib/router.js b/src/www/lib/router.js index 81d937c..04a9ad4 100644 --- a/src/www/lib/router.js +++ b/src/www/lib/router.js @@ -13,18 +13,34 @@ const routes = [ { path: '/', name: 'home', - component: Home + component: Home, + meta: { + title: 'Dashbi' + } }, { path: '/layout/:name', - component: Layout + component: Layout, + meta: { + title: 'Layout' + } }, { path: '*', - component: Error404 + component: Error404, + meta: { + title: 'Error 404' + } } ]; -export default new Router({ +const router = new Router({ routes }); + +router.beforeEach( (to, from, next) => { + document.title = to.meta.title; + next(); +}); + +export default router;