hasCurrentRoute
Checks whether the active route name is part of a known list. Use it when a nav item or layout state should be active for several related routes.
Importing
ts
import { hasCurrentRoute } from '@almighty-shogun/vue-utils'Usage
ts
import { hasCurrentRoute } from '@almighty-shogun/vue-utils'
const isInUsersArea = hasCurrentRoute(['users.index', 'users.show']);Parameters
| Name | Type | Description |
|---|---|---|
routes | string[] | Application route names. |
Returns
true when the current route name is in routes.
Type signature
ts
declare function hasCurrentRoute(routes: string[]): boolean;