← All templates

请求与响应 <RequestResponse />

左右两个代码窗:左边是发出的请求,右边是返回的响应,中间一条带标签的箭头,上面有光点从左跑到右。

Template and style descriptions are currently available in Chinese only.

See it in the demo deck →

Group
技术 · 一次往返
Component
RequestResponse · #request-response
Interaction
箭头和响应是一个 build 步骤;光点动画在减少动态效果和打印时关闭

Good for

  • 讲一次 API 调用、SQL 语句和返回、协议往返
  • 请求和响应都能用几行文本表示

Avoid when

  • 有多次往返或多方参与:用 SessionSequence
  • 只有命令和输出、没有“两端”之分:用 Terminal

Content limits

1label ≤ 10 字;file ≤ 20 个字符
2lines 2–9 行,每行 ≤ 36 个字符
3via ≤ 8 字
4note ≤ 50 字

Fields

FieldType
kicker · requiredstring标题上方的小节名,2–8 字
title · requiredstring | string[]页面标题;传数组可手动断行,每项一行
leadstring一到两句导语,≤ 60 字
sourcestring事实出处;页面上有任何数据或事实时必填
hintReactNode页眉中间的操作提示,可用 <kbd>
request · required{ label, file?, lines }请求
response · required{ label, file?, lines }响应
viastring箭头下的标签
notestring下方的一句解读

Example

<RequestResponse kicker="一次往返" title="…" request={{ label: '客户端发送', lines: ['UPDATE …'] }} via="一次往返" response={{ label: '服务器返回', lines: ['UPDATE 1'] }} />