mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-06 06:42:25 +03:00
chore: update ssr example in readme
This commit is contained in:
@@ -144,6 +144,7 @@ unmount() // Remove metadata when needed
|
||||
|
||||
```js
|
||||
import { createSSRApp } from 'vue'
|
||||
import { renderToString } from '@vue/server-renderer'
|
||||
import { renderToStringWithMeta } from 'vue-meta/ssr'
|
||||
import { App, metaManager } from './App'
|
||||
|
||||
@@ -151,7 +152,9 @@ export function renderPage() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(metaManager)
|
||||
|
||||
const [appHtml, ctx] = await renderToStringWithMeta(app)
|
||||
const ctx = {}
|
||||
const appHtml = await renderToString(app, ctx)
|
||||
await renderMetaToString(app, ctx)
|
||||
|
||||
return `
|
||||
<html ${ctx.teleports.htmlAttrs || ''}>
|
||||
|
||||
Reference in New Issue
Block a user