Context
In addition to a URL path string, any arbitrary data can be passed to a route action method.
const routes = [
{ path: '/hello', action: (context) => `<hello-page user="${context.user}"></hello-page>` }
]
const options = {
context: { user: 'admin' }
}
const router = createRouter(routes, '#router-outlet', options)Router always adds the following parameters to the context object
before passing it to the resolveRoute function:
router- Current router instanceroute- Matched route objectpath- Matched pathparams- Matched path and query string params, see URL Parameters section above for details