mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
feat: add support for useHead
(#122)
* feat: add support for `useHead` * chore: use sigma@75 Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
8e320f80aa
commit
3f99bb7878
@ -1,8 +1,10 @@
|
||||
import head from 'nuxt/app/plugins/head'
|
||||
import router from 'nuxt/app/plugins/router'
|
||||
import vuex from 'nuxt/app/plugins/vuex'
|
||||
import legacy from 'nuxt/app/plugins/legacy'
|
||||
|
||||
export default [
|
||||
head,
|
||||
router,
|
||||
vuex,
|
||||
legacy
|
||||
|
13
packages/nuxt3/src/app/plugins/head.ts
Normal file
13
packages/nuxt3/src/app/plugins/head.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import type { Plugin } from 'nuxt/app'
|
||||
import { createHead, renderHeadToString } from '@vueuse/head'
|
||||
|
||||
export default <Plugin> function head (nuxt) {
|
||||
const { app, ssrContext } = nuxt
|
||||
const head = createHead()
|
||||
|
||||
app.use(head)
|
||||
|
||||
if (process.server) {
|
||||
ssrContext.head = () => renderHeadToString(head)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user