iter(g112): 消息提示支持撤销类操作
This commit is contained in:
+4
-1
@@ -1,6 +1,6 @@
|
||||
# @ui-arch 组件库 Agent 文档(无图形版)
|
||||
|
||||
> 自动生成于 2026-10-26T06:04:26.861Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
|
||||
> 自动生成于 2026-10-26T06:05:26.104Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
|
||||
> 组件 = 普通函数,传 props 返回 DOM;状态用 signal 双向绑定:读 signal() 写 signal(v)。
|
||||
|
||||
## 快速上手
|
||||
@@ -555,6 +555,8 @@ skeleton({ variant: 'text', rows: 3 }); skeleton({ variant: 'circle' }); skeleto
|
||||
- duration(默认 3000):number —— 自动消失毫秒;缺省 3000
|
||||
- closable(默认 false):boolean —— 显示关闭按钮,点 × 立即收起;缺省 false(仅可关闭的 toast 接收指针事件,其余保持穿透)
|
||||
- variant(默认 info):'info' | 'success' | 'warning' | 'danger' —— 语义色;缺省 info(toast.error 对应 danger)
|
||||
- actionLabel:string —— 操作按钮文案(如「撤销」);传了才渲染,点后 toast 立即收起
|
||||
- onAction(回调):() => void —— 操作按钮回调,在 toast 收起之后触发(撤销删除之类)
|
||||
|
||||
示例:
|
||||
|
||||
@@ -569,6 +571,7 @@ toast.success('保存成功'); toast.error('网络请求失败', 5000)
|
||||
3. 多条消息在右上角自动纵向堆叠,互不遮挡
|
||||
4. 需要完整入参(含 variant)时用 showToast(props);组件挂载容器由内部懒创建,样式随 ui.css 一起引入
|
||||
5. 同屏最多 4 条,超出自动挤掉最早一条;需要用户主动确认的消息用 showToast({ closable: true }) 给个 ×
|
||||
6. 要「撤销」这类操作时给 showToast 传 actionLabel 与 onAction:按钮出现在文案右侧,点完先收起再回调,duration 建议放到 5000 让用户来得及点
|
||||
|
||||
现场演示:apps/docs/demo.html#sec-toast
|
||||
|
||||
|
||||
Reference in New Issue
Block a user