Skip to content

Commit adada63

Browse files
committed
doc(Vue): fix options API usage
Fixes #547
1 parent edecdeb commit adada63

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

docs/0.vue/head/guides/1.core-concepts/3.options-api.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,39 @@ Vue Unhead provides opt-in functionality to the options API, allowing you to def
1111

1212
## Setup
1313

14-
Import the options API mixin from the `@unhead/vue`{lang="bash"} package and add it to any Vue app entry files.
14+
To use the options API, you need to install the mixin `VueHeadMixin` with Vue.
1515

16-
```ts {1,6}
17-
import { createHead, VueHeadMixin } from '@unhead/vue'
18-
import { createApp } from 'vue'
16+
The mixin is exported by both the client and server entry files
17+
of Unhead, `@unhead/vue/client`{lang="ts"} and `@unhead/vue/server`{lang="ts"} respectively and you'll need
18+
to install it for both depending on if you server render or not.
1919

20-
const app = createApp()
20+
::code-group
21+
22+
```ts{2,7} [Client]
23+
import { createApp } from './main'
24+
import { createHead, VueHeadMixin } from '@unhead/vue/client'
25+
26+
const { app } = createApp()
2127
const head = createHead()
28+
app.use(head)
2229
app.mixin(VueHeadMixin)
30+
31+
app.mount('#app')
32+
```
33+
34+
```ts{2,7} [Server]
35+
import { createApp } from './main'
36+
import { createHead, VueHeadMixin } from '@unhead/vue/server'
37+
38+
const { app } = createApp()
39+
const head = createHead()
40+
app.use(head)
41+
app.mixin(VueHeadMixin)
42+
43+
app.mount('#app')
2344
```
2445

25-
If you're SSR make sure you update the client and server entry files.
46+
::
2647

2748
## Usage
2849

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy