SSR 类型
SSRContext
SSR 上下文类型。
ts
type SSRContext<T = Record<string, any>> = T & SSRInternalContext说明:SSR 上下文是一个扩展了 SSRInternalContext 的泛型对象,用于在服务端渲染期间共享数据。
SSRInternalContext
SSR 内部上下文。
ts
interface SSRInternalContext {
$isHydrating?: boolean
}属性:
| 属性 | 类型 | 说明 |
|---|---|---|
$isHydrating | boolean | 是否正在进行水合 |
Sink
流式渲染接收器。
ts
interface Sink {
push(content: string): void
}方法:
| 方法 | 说明 |
|---|---|
push() | 写入数据块 |
StreamingSink
流式渲染接收器(扩展)。
ts
interface StreamingSink extends Sink {
close(): void
error(error: unknown): void
}方法:
| 方法 | 说明 |
|---|---|
push() | 写入数据块 |
close() | 结束写入 |
error() | 报告错误 |