「消息收件箱」包含在 Pro 里,开通会员后显示预览。
用法
import { DashboardInbox } from './DashboardInbox.jsx'
// Without items the inbox shows its sample morning. Wire it to yours; an item of your own kind
// brings its tag, badge icon and action words:
<DashboardInbox
locale="en"
items={inbox.items} // [{ id, kind, from, title, body, at, unread?, detail?, tag?, icon?, actionLabel?, actionDone? }]
onOpen={(item) => inbox.open(item.id)}
onMarkRead={(item, read) => inbox.mark(item.id, read)}
onMarkAllRead={() => inbox.markAllRead()}
onArchive={(item) => inbox.archive(item.id)} // called once the undo has run out
onAction={(item, reply) => inbox.act(item, reply)} // the reading pane's main button (reply: the text typed for a mention); may return a promise
loading={inbox.loading}
error={inbox.error}
onRetry={inbox.reload}
/>属性
| 属性 | 类型 | 默认值 | 作用 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 内置文字、示例消息和时间格式所用的语言。 |
items | Array<{ id, kind, from, title, body, at, unread?, detail?, tag?, icon?, actionLabel?, actionDone? }> | sample morning | 按时间倒序。kind 为 'mention' 时带回复框;'order'、'stock'、'team' 有内置的标签、角标和操作,其他 kind 用条目自带的 tag(标签)、icon(角标:图标名或节点)、actionLabel 和 actionDone(主按钮操作前后的文字)。at 为日期或日期字符串;detail 是 [名称, 值] 列表,显示成一张小票据。 |
now | Date | string | now | “今天”“昨天”分组以哪一天为准。 |
onOpen / onMarkRead | (item) => void / (item, read) => void | — | 打开了一条消息(会标为已读),或用行内按钮标为已读、未读。 |
onMarkAllRead | () => void | — | 全部标为已读时调用。 |
onArchive | (item) => void | — | 归档了一条消息,且撤销提示已到时或被关闭。点撤销会放回原处,不会调用它。 |
onAction | (item, reply) => Promise | void | — | 阅读区主按钮(回复、查看订单等);提及消息会带上阅读区里写的回复。返回 Promise 时按钮会等它完成。 |
loading | boolean | false | 显示收件箱的骨架。 |
error / onRetry | boolean | string / () => void | false | 显示带重试按钮的错误提示;传字符串可替换说明。 |
labels | object | — | 替换任意内置文字(键名见 copy.js)。 |
className | string | — | 加在根元素上的类名。 |
装进你的项目
Pro 包含这个区块的完整源码。复制指令,让你的 Agent 把它安装到项目中。
DashboardInbox.jsxdashboard-inbox.csscopy.jskit.jsxkit.cssui/base-button/ui/empty-state/ui/alert-banner/ui/undo-snackbar/ui/skeleton-shimmer/ui/sliding-tabs/tokens.cssREADME.md
区块本身、样式和文案、共用的 kit、用到的组件和 tokens.css 会一起装进同一个文件夹。
