0.15.14 • Published 1 year ago
@css-render/vue3-ssr v0.15.14
@css-render/vue3-ssr
Example
Server
import { createSSRApp } from 'vue'
import { renderToString } from '@vue/server-renderer'
import { setup } = from '@css-render/vue3-ssr'
// For each request, you need to create a new app
const ssrApp = createSSRApp(App)
const { collect } = setup(ssrApp)
renderToString(ssrApp).then(appHtml => {
const css = collect()
const page = `<!DOCTYPE html>
<html>
<head>${css}</head>
<body><div id="app">${appHtml}</div></body>
</html>`
})
Component
import { defineComponent } from 'vue'
import { useSsrAdapter } from '@css-render/vue3-ssr'
const Child = defineComponent({
setup() {
c("div", {
color: "red",
}).mount({
id: "mount-id",
// It always returns undefined in browser (document === undefined)
ssr: useSsrAdapter(),
});
},
render() {
return h("div", null, "Child");
},
});
0.15.14
1 year ago
0.15.13
1 year ago
0.15.12
2 years ago
0.15.11
3 years ago
0.15.10
3 years ago
0.15.9
3 years ago
0.15.7
3 years ago
0.15.8
3 years ago
0.15.6
4 years ago
0.15.5
4 years ago
0.15.4
4 years ago
0.15.0
4 years ago
0.15.1
4 years ago
0.15.2
4 years ago
0.15.3
4 years ago
0.13.7
4 years ago
0.13.8
4 years ago
0.13.9
4 years ago
0.14.0
4 years ago
0.14.1
4 years ago
0.13.6
4 years ago
0.13.4
4 years ago
0.13.5
4 years ago
0.13.2
4 years ago
0.13.1
4 years ago
0.13.0
4 years ago