-
-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract defaultResolver into it's own util
- Loading branch information
1 parent
a5dd2c6
commit 11b0941
Showing
3 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Generates a route resolver for a given component, to which it provides | ||
* a key as a 'routeName' attr. | ||
*/ | ||
export default function defaultResolver(component, key) { | ||
return { | ||
onmatch(args, requestedPath, route) { | ||
return component; | ||
}, | ||
|
||
render(vnode) { | ||
vnode.attrs.routeName = key; | ||
|
||
return vnode; | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters