fix payload for nuxt2

This commit is contained in:
Pooya Parsa 2020-11-03 23:38:46 +01:00
parent 55819d52e0
commit a8db45a8ba

View File

@ -28,7 +28,7 @@ export async function render (url, ctx: any) {
} }
const rendered = await renderer.renderToString(ssrContext) const rendered = await renderer.renderToString(ssrContext)
const state = `<script>window.__NUXT__ = ${devalue(ssrContext.payload)}</script>` const state = `<script>window.__NUXT__=${devalue(ssrContext.nuxt /* nuxt 2 */ || ssrContext.payload /* nuxt 3 */)}</script>`
const _html = `<div id="__nuxt">${rendered.html}</div>` const _html = `<div id="__nuxt">${rendered.html}</div>`
const html = htmlTemplate({ const html = htmlTemplate({