Nuxt/packages/nitro/src/runtime/vue2.ts

15 lines
367 B
TypeScript
Raw Normal View History

2020-11-02 00:54:31 +00:00
import { createRenderer } from 'vue-server-renderer/build.prod.js'
const _renderer = createRenderer({})
2020-11-01 23:17:44 +00:00
export function renderToString (component, context) {
return new Promise((resolve, reject) => {
2020-11-02 00:54:31 +00:00
_renderer.renderToString(component, context, (err, result) => {
2020-11-01 23:17:44 +00:00
if (err) {
return reject(err)
}
return resolve(result)
})
})
}