为什么捐赠
API 浏览器
联系站长
徽章

QBadge(徽标)组件用于创建一个小徽标来添加一些引人注目的信息,例如经常有人把他放在头像组件上来显示有几条新消息。

正在加载 QBadge API...

用法

基础


字符串作为内容


对齐


圆角


描边


透明度


浮动徽章


自定义内容


Accessibility
v2.25+

QBadge renders with role="status" — a polite live region — and takes its aria-label from the label prop, so a badge whose label changes after render is announced automatically (content coming through the default slot is read as plain text instead).

A floating badge is attached to its host element only visually; there is no programmatic association between the two. Make sure the host’s own accessible name carries the badge’s meaning — “Inbox, 4 unread” rather than a bare “4” floating next to an unlabeled icon.