mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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
|
// @ts-ignore
|
||||||
import metaConfig from '#build/meta.config.mjs'
|
import metaConfig from '#build/meta.config.mjs'
|
||||||
|
|
||||||
|
type MetaComponents = typeof Components
|
||||||
|
declare module 'vue' {
|
||||||
|
export interface GlobalComponents extends MetaComponents {}
|
||||||
|
}
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
useMeta(metaConfig.globalMeta)
|
useMeta(metaConfig.globalMeta)
|
||||||
|
|
||||||
|
@ -12,6 +12,15 @@ import { defineNuxtPlugin } from '#app'
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import routes from '#build/routes'
|
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) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
nuxtApp.vueApp.component('NuxtChild', NuxtChild)
|
nuxtApp.vueApp.component('NuxtChild', NuxtChild)
|
||||||
nuxtApp.vueApp.component('NuxtPage', NuxtPage)
|
nuxtApp.vueApp.component('NuxtPage', NuxtPage)
|
||||||
|
Loading…
Reference in New Issue
Block a user