Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suggestions for the official website documentation of vue-router #2525

maxingru started this conversation in Ideas
Discussion options

the Chinese documents of official website: https://router.vuejs.org/zh/api/interfaces/RouteMeta.html#%E6%8E%A5%E5%8F%A3-RouteMeta

接口:RouteMeta
路由记录中的 meta 字段的类型接口。
Example
// typings.d.ts 或 router.ts
import 'vue-router';

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

  1. the first time i saw it, i felt that the object assigned to meta:{} must have the requiresAuth attribute to satisfy the structure type of TS.
  2. i think we should directly follow the code in the router source code : interface RouteMeta extends Record<PropertyKey,unknown>{}
You must be logged in to vote

Replies: 1 comment

Comment options

The example is showing how to extend the RouteMeta type to specify your own custom properties. It isn't trying to show you the definition from the source code.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /