mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 01:15:58 +00:00
feat(nuxt3): pass nuxtApp
to head()
(#2765)
This commit is contained in:
parent
e9d73f572f
commit
0af01668c1
@ -1,4 +1,4 @@
|
|||||||
import { getCurrentInstance } from 'vue'
|
import { computed, getCurrentInstance } from 'vue'
|
||||||
import * as Components from './components'
|
import * as Components from './components'
|
||||||
import { useMeta } from './composables'
|
import { useMeta } from './composables'
|
||||||
import { defineNuxtPlugin } from '#app'
|
import { defineNuxtPlugin } from '#app'
|
||||||
@ -19,7 +19,11 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||||||
const options = instance?.type || /* nuxt2 */ instance?.proxy?.$options
|
const options = instance?.type || /* nuxt2 */ instance?.proxy?.$options
|
||||||
if (!options || !('head' in options)) { return }
|
if (!options || !('head' in options)) { return }
|
||||||
|
|
||||||
useMeta(options.head)
|
const source = typeof options.head === 'function'
|
||||||
|
? computed(() => options.head(nuxtApp))
|
||||||
|
: options.head
|
||||||
|
|
||||||
|
useMeta(source)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user