mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-17 03:14:46 +00:00
15 lines
367 B
TypeScript
15 lines
367 B
TypeScript
import { createRenderer } from 'vue-server-renderer/build.prod.js'
|
|
|
|
const _renderer = createRenderer({})
|
|
|
|
export function renderToString (component, context) {
|
|
return new Promise((resolve, reject) => {
|
|
_renderer.renderToString(component, context, (err, result) => {
|
|
if (err) {
|
|
return reject(err)
|
|
}
|
|
return resolve(result)
|
|
})
|
|
})
|
|
}
|