iter(g112): 消息提示支持撤销类操作

This commit is contained in:
HIsheR
2026-10-26 14:05:38 +08:00
parent bf1bd2241b
commit 5372fdd1f3
8 changed files with 68 additions and 5 deletions
+13 -1
View File
@@ -1015,6 +1015,17 @@
"t": "'info' | 'success' | 'warning' | 'danger'",
"d": "语义色;缺省 info(toast.error 对应 danger)",
"df": "info"
},
{
"n": "actionLabel",
"t": "string",
"d": "操作按钮文案(如「撤销」);传了才渲染,点后 toast 立即收起"
},
{
"n": "onAction",
"t": "() => void",
"k": 1,
"d": "操作按钮回调,在 toast 收起之后触发(撤销删除之类)"
}
],
"example": "toast.success('保存成功'); toast.error('网络请求失败', 5000)",
@@ -1023,7 +1034,8 @@
"不传 duration 时默认停留 3 秒后自动淡出并移除节点",
"多条消息在右上角自动纵向堆叠,互不遮挡",
"需要完整入参(含 variant)时用 showToast(props);组件挂载容器由内部懒创建,样式随 ui.css 一起引入",
"同屏最多 4 条,超出自动挤掉最早一条;需要用户主动确认的消息用 showToast({ closable: true }) 给个 ×"
"同屏最多 4 条,超出自动挤掉最早一条;需要用户主动确认的消息用 showToast({ closable: true }) 给个 ×",
"要「撤销」这类操作时给 showToast 传 actionLabel 与 onAction:按钮出现在文案右侧,点完先收起再回调,duration 建议放到 5000 让用户来得及点"
]
},
{