File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1+ const internalKeysRE = / ^ ( c o m p o n e n t | s u b R o u t e s ) $ /
2+
13/**
24 * Route Context Object
35 *
810export default class Route {
911
1012 constructor ( path , router ) {
11- this . path = path
12- this . router = router
13-
1413 let matched = router . _recognizer . recognize ( path )
1514
15+ // copy all custom fields from route configs
16+ if ( matched ) {
17+ [ ] . forEach . call ( matched , match => {
18+ for ( let key in match . handler ) {
19+ if ( ! internalKeysRE . test ( key ) ) {
20+ this [ key ] = match . handler [ key ]
21+ }
22+ }
23+ } )
24+ }
25+
26+ this . path = path
27+ this . router = router
1628 this . query = matched
1729 ? matched . queryParams
1830 : { }
19-
2031 this . params = matched
21- ? [ ] . reduce . call ( matched , function ( prev , cur ) {
32+ ? [ ] . reduce . call ( matched , ( prev , cur ) => {
2233 if ( cur . params ) {
2334 for ( let key in cur . params ) {
2435 prev [ key ] = cur . params [ key ]
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ export default function (Vue, Router) {
44
55 /**
66 * Register a map of top-level paths.
7+ *
8+ * @param {Object } map
79 */
810
911 Router . prototype . map = function ( map ) {
You can’t perform that action at this time.
0 commit comments