反馈
反馈组件用于呈现操作前说明、加载进度与操作结果,均为不自行取数、不轮询的同步 SchemaComponent(样式由 feedback.css 与 progress.css 按需加载)。
提示条、可关闭提示条、空态与输入骨架:
每小时自动部署一次。
备份已完成。
还没有发票
第一笔订单完成后,发票会显示在这里。
加载中
查看后端实现源码(Rust)折叠 / 展开
fn feedback(ctx: RenderCtx<'_>) -> Html {
Html::fragment([
ctx.render(Alert::info("每小时自动部署一次。")),
ctx.render(Alert::success("备份已完成。").closable()),
ctx.render(
EmptyState::make()
.title("还没有发票")
.description("第一笔订单完成后,发票会显示在这里。"),
),
ctx.render(Skeleton::input()),
])
}按交互阶段选用反馈组件:
- 操作前:纯文本说明统一用
Tooltip(仅<option>与 SVG<title>用原生;自定义调ActionChrome::wrap_tooltip、PreparedColumn::wrap_cell_tooltip);含操作用Popover,不可逆确认用Popconfirm。 - 操作中:命令在途用
Spin或LoadingOverlay的while_loading(targets),首屏未就绪用Skeleton,耗时超 2 秒的操作用Progress展示进度并提供取消入口。 - 操作后:成功用自动消失的
Notification::success,字段报错走校验提示,区块失败用Alert,后台任务失败用常驻的Notification::danger,长流程终态汇总用ResultView。
独立 SDUI 页面在布局骨架中放入 OfflineNotice::make() 即可在断线超 1 秒时自动显示底部重连提示条(Fly Panel 已内置,见 LIVECELL 第 7 节):
use kxed_livecell::sdui::{OfflineNotice, Schema};
Schema::new().component(OfflineNotice::make()).component(layout)内容区块可通过 StatusView 按 ViewState 统一分发加载、空态、报错、403 与 404 视图:
use kxed_livecell::sdui::{Schema, StatusView, ViewState};
StatusView::make(self.state.clone()).content(Schema::new().component(orders_table(&self.table))).retry("reloadOrders")| 组件 | 常用配置与行为细节 |
|---|---|
Alert | 支持 Success、Info、Warning、Error 四类及 description、actions、banner、without_icon;closable() 用局部状态隐藏,close_action(name) 额外通知服务端 |
EmptyState | 提供图标、标题、说明与 actions 引导下一步,simple() 切换紧凑形态 |
Skeleton | 默认标题加三行段落,支持 with_avatar、rows(<= 12)、round、active、size(Size)、loading(false) 与自由组合块 Skeleton::blocks |
Progress / RingProgress | Progress 支持线形、Progress::circle 与 Progress::dashboard(钳制 0..=100,满百默认 Success,支持 steps(n) 与多段 section);RingProgress 渲染多段圆环与 center 内容 |
Spin / LoadingOverlay | 服务端由 Spin::spinning(bool) / LoadingOverlay::visible(bool) 控制,客户端在途由 while_loading(targets) 控制;Spin 支持 label、tip、silent() |
ResultView | ResultStatus 含 Success/Error/Info/Warning/Forbidden/NotFound/ServerError(带 kxed-result-code),支持 extra、content 与 page_heading() |
StatusView | 将 ViewState(Ready/Loading/Empty/Error/Forbidden/NotFound,result_status() 转 ResultStatus)映射为对应视图,支持 retry 与 retry_label |
OfflineNotice | 带 OFFLINE_ATTRIBUTE(data-livecell-offline),文案键 sdui-offline/sdui-offline-detail(offline-notice.css,自动避让 --kxed-offline-notice-block-size) |
Notification | 调 send 或 notify(见事件之外通知用户),由 notification_renderer()/NotificationTheme 渲染 |
Notification级别与存活:含LEVEL_INFO、success、warning、danger(danger常驻,其余 5 秒消失,可用duration或persistent()调整);同屏上限DEFAULT_NOTIFICATION_LIMIT(5 条,NotificationTheme::limit(n)可改)。- 通知无障碍与多节点:关闭键读屏名取
sdui-notification-close(见界面语言);多节点集群下经 relay 校验封印并扇出(见 LIVECELL 第 8.2 节)。