feat(compiler-ssr): compile portal (#775)
This commit is contained in:
committed by
GitHub
parent
312513d255
commit
d8ed0e7fbf
20
packages/server-renderer/src/helpers/ssrRenderPortal.ts
Normal file
20
packages/server-renderer/src/helpers/ssrRenderPortal.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { ComponentInternalInstance, ssrContextKey } from 'vue'
|
||||
import { SSRContext, createBuffer, PushFn } from '../renderToString'
|
||||
|
||||
export function ssrRenderPortal(
|
||||
contentRenderFn: (push: PushFn) => void,
|
||||
target: string,
|
||||
parentComponent: ComponentInternalInstance
|
||||
) {
|
||||
const { getBuffer, push } = createBuffer()
|
||||
|
||||
contentRenderFn(push)
|
||||
|
||||
const context = parentComponent.appContext.provides[
|
||||
ssrContextKey as any
|
||||
] as SSRContext
|
||||
const portalBuffers =
|
||||
context.__portalBuffers || (context.__portalBuffers = {})
|
||||
|
||||
portalBuffers[target] = getBuffer()
|
||||
}
|
||||
Reference in New Issue
Block a user