File tree 2 files changed +51
-37
lines changed
2 files changed +51
-37
lines changed Original file line number Diff line number Diff line change @@ -49,46 +49,45 @@ var root = new Vue({
49
49
}
50
50
} )
51
51
52
- router . on ( '/inbox' , {
53
- name : 'inbox' ,
54
- component : 'inbox' ,
55
- subRoutes : {
56
- '/message/:messageId' : {
57
- name : 'message' ,
58
- component : 'message' ,
59
- alwaysRefresh : true
60
- } ,
61
- '/archived' : {
62
- name : 'archive' ,
63
- component : 'archive'
52
+ router . map ( {
53
+ '/inbox' : {
54
+ name : 'inbox' ,
55
+ component : 'inbox' ,
56
+ subRoutes : {
57
+ '/message/:messageId' : {
58
+ name : 'message' ,
59
+ component : 'message' ,
60
+ alwaysRefresh : true
61
+ } ,
62
+ '/archived' : {
63
+ name : 'archive' ,
64
+ component : 'archive'
65
+ }
64
66
}
65
- }
66
- } )
67
-
68
- router . on ( '/user/:userId' , {
69
- name : 'user' ,
70
- component : 'user' ,
71
- subRoutes : {
72
- 'profile/:something' : {
73
- component : 'user-profile'
74
- } ,
75
- 'posts' : {
76
- component : 'user-posts'
77
- } ,
78
- 'settings' : {
79
- component : 'user-settings'
67
+ } ,
68
+ '/user/:userId' : {
69
+ name : 'user' ,
70
+ component : 'user' ,
71
+ subRoutes : {
72
+ 'profile/:something' : {
73
+ component : 'user-profile'
74
+ } ,
75
+ 'posts' : {
76
+ component : 'user-posts'
77
+ } ,
78
+ 'settings' : {
79
+ component : 'user-settings'
80
+ }
80
81
}
82
+ } ,
83
+ '/about' : {
84
+ component : 'about'
85
+ } ,
86
+ '*' : {
87
+ component : 'not-found'
81
88
}
82
89
} )
83
90
84
- router . on ( '/about' , {
85
- component : 'about' ,
86
- } )
87
-
88
- router . notfound ( {
89
- component : 'not-found'
90
- } )
91
-
92
91
router . redirect ( {
93
92
'/info' : '/about'
94
93
} )
Original file line number Diff line number Diff line change @@ -35,9 +35,20 @@ var p = VueRouter.prototype
35
35
//
36
36
// Public API
37
37
//
38
+ //
38
39
39
40
/**
40
- * Register a root-level path
41
+ * Register a map of top-level paths.
42
+ */
43
+
44
+ p . map = function ( map ) {
45
+ for ( var route in map ) {
46
+ this . on ( route , map [ route ] )
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Register a single root-level path
41
52
*
42
53
* @param {String } rootPath
43
54
* @param {Object } config
@@ -49,7 +60,11 @@ var p = VueRouter.prototype
49
60
*/
50
61
51
62
p . on = function ( rootPath , config ) {
52
- this . _addRoute ( rootPath , config , [ ] )
63
+ if ( rootPath === '*' ) {
64
+ this . notfound ( config )
65
+ } else {
66
+ this . _addRoute ( rootPath , config , [ ] )
67
+ }
53
68
}
54
69
55
70
/**
You can’t perform that action at this time.
0 commit comments