mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +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 router from 'nuxt/app/plugins/router'
|
||||||
import vuex from 'nuxt/app/plugins/vuex'
|
import vuex from 'nuxt/app/plugins/vuex'
|
||||||
import legacy from 'nuxt/app/plugins/legacy'
|
import legacy from 'nuxt/app/plugins/legacy'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
head,
|
||||||
router,
|
router,
|
||||||
vuex,
|
vuex,
|
||||||
legacy
|
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