Skip to content

vue-router / RouteMeta

RouteMeta ​

Interface to type meta fields in route records.

Example ​

ts
// typings.d.ts or router.ts
import 'vue-router';

declare module 'vue-router' {
  interface RouteMeta {
    requiresAuth?: boolean
  }
}

Extends ​

  • Record<PropertyKey, unknown>

Indexable ​

ts
[key: string]: unknown
ts
[key: number]: unknown
ts
[key: symbol]: unknown

Properties ​

[ABORT_CONTROLLER_KEY]? ​

ts
optional [ABORT_CONTROLLER_KEY]?: AbortController;

Internal

The signal that is aborted when the navigation is canceled or an error occurs.


[LOADER_SET_KEY]? ​

ts
optional [LOADER_SET_KEY]?: Set<UseDataLoader<unknown, unknown>>;

Internal

Set of loaders for the current route. This is built once during navigation and is used to merge the loaders from the lazy import in components or the loaders array in the route record.


loaders? ​

ts
optional loaders?: UseDataLoader<unknown, unknown>[];

The data loaders for a route record. Add any data loader to this array to have it called when the route is navigated to. Note this is only needed when not using lazy components (() => import('./pages/Home.vue')) or when not explicitly exporting data loaders from page components.

This requires the use of the experimental data loaders and is ignored otherwise.

See ​

DataLoaderPlugin

Released under the MIT License.