第一次提交

This commit is contained in:
2025-05-02 13:09:37 +08:00
commit ea5690fe88
39 changed files with 11346 additions and 0 deletions

19
src/entry-server.js Normal file
View File

@ -0,0 +1,19 @@
import { renderToWebStream, renderToString } from 'vue/server-renderer'
import { createApp } from './main'
export async function render(_url, cookies, host) {
const { app, pinia, router } = createApp()
await router.push(_url)
await router.isReady()
const ctx = {
cookies,
host,
initialState: {}
}
// await new Promise((resolve) => setTimeout(resolve, 0))
const stream = renderToWebStream(app, ctx)
const initialState = ctx.initialStat
const piniaState = pinia.state.value
return { stream, initialState, piniaState }
}