mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
feat(nuxt3): add global type definitions for built-in components (#2340)
This commit is contained in:
parent
617a65a691
commit
fb33033f45
@ -5,6 +5,11 @@ import { defineNuxtPlugin } from '#app'
|
||||
// @ts-ignore
|
||||
import metaConfig from '#build/meta.config.mjs'
|
||||
|
||||
type MetaComponents = typeof Components
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents extends MetaComponents {}
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
useMeta(metaConfig.globalMeta)
|
||||
|
||||
|
@ -12,6 +12,15 @@ import { defineNuxtPlugin } from '#app'
|
||||
// @ts-ignore
|
||||
import routes from '#build/routes'
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
NuxtChild: typeof NuxtChild
|
||||
NuxtPage: typeof NuxtPage
|
||||
NuxtLayout: typeof NuxtLayout
|
||||
NuxtLink: typeof RouterLink
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
nuxtApp.vueApp.component('NuxtChild', NuxtChild)
|
||||
nuxtApp.vueApp.component('NuxtPage', NuxtPage)
|
||||
|
Loading…
Reference in New Issue
Block a user