vue3-yuanma/packages/server-renderer/README.md
2020-02-18 14:56:53 -05:00

17 lines
317 B
Markdown

# @vue/server-renderer
``` js
const { createSSRApp } = require('vue')
const { renderToString } = require('@vue/server-renderer')
const app = createSSRApp({
data: () => ({ msg: 'hello' }),
template: `<div>{{ msg }}</div>`
})
;(async () => {
const html = await renderToString(app)
console.log(html)
})()
```