-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-
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
}
}
- 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.
- i think we should directly follow the code in the router source code :
interface RouteMeta extends Record<PropertyKey,unknown>{}
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment