test vite ssr

This commit is contained in:
polv committed 2022-05-07 19:28:04 +07:00
1 parent 6725bf89ad
commit 066f94188a
20 files changed
+406

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { createSSRApp, defineComponent, h } from 'vue'
import PageShell from './PageShell.vue'
import { setPageContext } from './usePageContext'
import type { PageContext } from './types'
export { createApp }
function createApp(pageContext: PageContext) {
const { Page, pageProps } = pageContext
const PageWithLayout = defineComponent({
render() {
return h(
PageShell,
{},
{
default() {
return h(Page, pageProps || {})
},
},
)
},
})
const app = createSSRApp(PageWithLayout)
// Make `pageContext` available from any Vue component
setPageContext(app, pageContext)
return app
}