2022-01-26 11:56:24 +00:00
|
|
|
import { KeepAliveProps, TransitionProps, UnwrapRef } from 'vue'
|
2022-02-21 13:03:42 +00:00
|
|
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
2022-01-17 18:27:23 +00:00
|
|
|
|
|
|
|
export interface PageMeta {
|
|
|
|
[key: string]: any
|
2022-02-07 10:17:28 +00:00
|
|
|
pageTransition?: boolean | TransitionProps
|
|
|
|
layoutTransition?: boolean | TransitionProps
|
2022-02-07 11:32:04 +00:00
|
|
|
key?: false | string | ((route: RouteLocationNormalizedLoaded) => string)
|
2022-02-07 10:17:28 +00:00
|
|
|
keepalive?: boolean | KeepAliveProps
|
2022-01-17 18:27:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare module 'vue-router' {
|
2022-01-26 11:56:24 +00:00
|
|
|
interface RouteMeta extends UnwrapRef<PageMeta> {}
|
2022-01-17 18:27:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const warnRuntimeUsage = (method: string) =>
|
|
|
|
console.warn(
|
|
|
|
`${method}() is a compiler-hint helper that is only usable inside ` +
|
2022-02-11 08:59:52 +00:00
|
|
|
'the script block of a single file component. Its arguments should be ' +
|
2022-01-17 18:27:23 +00:00
|
|
|
'compiled away and passing it at runtime has no effect.'
|
|
|
|
)
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
export const definePageMeta = (meta: PageMeta): void => {
|
|
|
|
if (process.dev) {
|
|
|
|
warnRuntimeUsage('definePageMeta')
|
|
|
|
}
|
|
|
|
}
|