@@ -25,40 +25,58 @@ import AppSidebar from './views/AppSidebar.vue'
25
25
import Calendar from './views/AppContent/Calendar.vue'
26
26
import Collections from './views/AppContent/Collections.vue'
27
27
28
- import { createWebHashHistory , createRouter } from 'vue-router'
28
+ import { h } from 'vue'
29
+ import { createWebHashHistory , createRouter , RouterView } from 'vue-router'
29
30
30
31
const routes = [
31
- // using
32
- // { path: '/collections/all', component: CollectionGeneral, alias: '/' },
33
- // instead of
34
32
{ path : '/' , redirect : getInitialRoute ( ) } ,
35
- // would also be an option, but it currently does not work
36
- // reliably with router-link due to
37
- // https://github.com/vuejs/vue-router/issues/419
38
- { name : 'collections' , path : '/collections/:collectionId' , component : Collections , props : true } ,
39
33
{
40
- name : 'collectionsTask' ,
41
- path : '/collections/:collectionId/tasks/:taskId' ,
42
- components : { default : Collections , sidebar : AppSidebar } ,
43
- props : { default : true , sidebar : true } ,
34
+ path : '/collections/:collectionId' ,
35
+ components : {
36
+ default : { render : ( ) => h ( RouterView , { name : 'default' } ) } ,
37
+ AppSidebar : { render : ( ) => h ( RouterView , { name : 'AppSidebar' } ) } ,
38
+ } ,
39
+ children : [
40
+ {
41
+ name : 'collections' ,
42
+ path : '/collections/:collectionId' ,
43
+ component : Collections ,
44
+ props : true
45
+ } ,
46
+ {
47
+ name : 'collectionsTask' ,
48
+ path : '/collections/:collectionId/tasks/:taskId' ,
49
+ components : { default : Collections , AppSidebar } ,
50
+ props : { default : true , AppSidebar : true } ,
51
+ } ,
52
+ {
53
+ name : 'collectionsParamTask' ,
54
+ path : '/collections/:collectionId/:collectionParam/tasks/:taskId' ,
55
+ components : { default : Collections , AppSidebar } ,
56
+ props : { default : true , AppSidebar : true } ,
57
+ } ,
58
+ ]
44
59
} ,
45
60
{
46
- name : 'collectionsParamTask' ,
47
- path : '/collections/:collectionId/:collectionParam/tasks/:taskId' ,
48
- components : { default : Collections , sidebar : AppSidebar } ,
49
- props : { default : true , sidebar : true } ,
50
- } ,
51
- {
52
- name : 'calendars' ,
53
61
path : '/calendars/:calendarId' ,
54
- component : Calendar ,
55
- props : true ,
56
- } ,
57
- {
58
- name : 'calendarsTask' ,
59
- path : '/calendars/:calendarId/tasks/:taskId' ,
60
- components : { default : Calendar , sidebar : AppSidebar } ,
61
- props : { default : true , sidebar : true } ,
62
+ components : {
63
+ default : { render : ( ) => h ( RouterView , { name : 'default' } ) } ,
64
+ AppSidebar : { render : ( ) => h ( RouterView , { name : 'AppSidebar' } ) } ,
65
+ } ,
66
+ children : [
67
+ {
68
+ name : 'calendars' ,
69
+ path : '/calendars/:calendarId' ,
70
+ component : Calendar ,
71
+ props : true ,
72
+ } ,
73
+ {
74
+ name : 'calendarsTask' ,
75
+ path : '/calendars/:calendarId/tasks/:taskId' ,
76
+ components : { default : Calendar , AppSidebar } ,
77
+ props : { default : true , AppSidebar : true } ,
78
+ } ,
79
+ ]
62
80
} ,
63
81
]
64
82
0 commit comments