-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrouter.js
More file actions
39 lines (33 loc) · 1.37 KB
/
Copy pathrouter.js
File metadata and controls
39 lines (33 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Vue from 'vue';
import Router from 'vue-router';
import Search from '~/pages/search/Search';
import AboutProject from '~/pages/about/AboutProject';
import Author from '~/pages/author/Author';
import Liturgy from '~/pages/liturgy/Liturgy';
Vue.use(Router);
export function createRouter() {
return new Router({
mode: 'history',
routes: [
{ name: 'index', path: '/', component: Search },
{ path: '/o-projektu', component: AboutProject },
{ path: '/pisen/:id/*', component: Search },
{ path: '/autor/:id', component: Author },
{ path: '/liturgie/aktualne', component: Liturgy },
{ path: '/liturgie/aktualne/:date', component: Liturgy },
{ path: '/vanoce', redirect: { name: 'index', query: { stitky: '22' } } },
{ path: '/velikonoce', redirect: { name: 'index', query: { stitky: '23' } } },
{ path: '/advent', redirect: { name: 'index', query: { stitky: '24' } } },
{ path: '/postni-doba', redirect: { name: 'index', query: { stitky: '25' } } }
],
scrollBehavior (to, from, savedPosition) {
if (to.hash) {
return { selector: to.hash }
} else if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
}
});
}