Skip to content

Commit

Permalink
feat(nuxt3): pass nuxtApp to head() (nuxt#2765)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jan 17, 2022
1 parent e9d73f5 commit 0af0166
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/nuxt3/src/meta/runtime/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCurrentInstance } from 'vue'
import { computed, getCurrentInstance } from 'vue'
import * as Components from './components'
import { useMeta } from './composables'
import { defineNuxtPlugin } from '#app'
Expand All @@ -19,7 +19,11 @@ export default defineNuxtPlugin((nuxtApp) => {
const options = instance?.type || /* nuxt2 */ instance?.proxy?.$options
if (!options || !('head' in options)) { return }

useMeta(options.head)
const source = typeof options.head === 'function'
? computed(() => options.head(nuxtApp))
: options.head

useMeta(source)
}
})

Expand Down

0 comments on commit 0af0166

Please sign in to comment.