Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
feat: Setting site title according to current layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Sierociński committed Aug 30, 2019
1 parent b3d3880 commit c2516ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/www/components/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
changeCurrent (layout) {
this.initWidgetsSources(layout.widgets);
this.current = layout;
document.title = layout.title;
},
/**
Expand Down
24 changes: 20 additions & 4 deletions src/www/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit c2516ca

Please sign in to comment.