组件参考
组件
组件表由运行时注册表生成。Agent、校验器、渲染器和文档站共享这份组件事实。
| 组件 | 分类 | 状态 | 常用属性 | 事件 | 用途 |
|---|---|---|---|---|---|
audio | 能力 | 协议优先 | id, class, style, hidden, data-*, id | bindplay, bindpause, bindended, binderror, bindload | 音频播放组件,配合 ac.playMedia 等媒体 API 控制。 |
button | 动作 | 稳定 | id, class, style, hidden, data-*, type | bindtap, bindsubmit | 触发用户操作、表单提交或点击事件的按钮。 |
camera | 能力 | 宿主能力 | id, class, style, hidden, data-*, device-position | binderror, bindload | 相机预览占位组件,由宿主相机 provider 提供真实能力。 |
canvas | 能力 | 协议优先 | id, class, style, hidden, data-*, canvas-id | bindtap, bindtouchstart, bindtouchmove, bindtouchend | 可绘制画布,通过 ac.drawCanvas 等宿主 API 控制。 |
card | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap | 用于承载一组相关内容的卡片容器。 |
checkbox | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 单个复选项,可独立使用或放入 checkbox-group。 |
checkbox-group | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 复选框组,将多个选中值汇总为数组。 |
code-editor | 表单 | 稳定 | id, class, style, hidden, data-*, editor-id | bindinput, bindchange, bindconfirm, bindfocus, bindblur, bindscroll, bindselectionchange, bindkeydown | 代码编辑区域,适合 Mermaid 等 DSL 输入,并提供输入和选区事件。 |
cover-image | 媒体 | 稳定 | id, class, style, hidden, data-*, src | bindtap, bindload, binderror | 覆盖层图片组件,用于需要浮层叠放的媒体内容。 |
cover-view | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap, bindtouchstart, bindtouchmove, bindtouchend | 覆盖层视图容器,可承载浮层内容。 |
diagram-view | 能力 | 协议优先 | id, class, style, hidden, data-*, diagram-id | bindtap, bindtouchstart, bindtouchmove, bindtouchend, bindpointerdown, bindpointermove, bindpointerup, bindwheel, bindcontextmenu | 安全 SVG 图表预览区域,可配合 ac.renderMermaid 渲染 Mermaid。 |
empty | 反馈 | 稳定 | id, class, style, hidden, data-* | bindtap | 空状态展示组件。 |
form | 表单 | 稳定 | id, class, style, hidden, data-* | bindsubmit | 表单容器,提交时收集子控件值到 event.detail.value。 |
icon | 内容 | 稳定 | id, class, style, hidden, data-*, type | bindtap | 小型语义图标标记。 |
image | 媒体 | 稳定 | id, class, style, hidden, data-*, src | bindtap, bindload, binderror | 图片资源展示组件。 |
input | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindinput, bindchange, bindconfirm, bindfocus, bindblur | 单行文本输入控件。 |
label | 表单 | 稳定 | id, class, style, hidden, data-*, for | bindtap | 表单标签,可通过 for 关联控件。 |
list | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap | 列表容器。 |
list-item | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap | 列表项容器。 |
loading | 反馈 | 稳定 | id, class, style, hidden, data-* | - | 加载状态展示组件。 |
map | 能力 | 宿主能力 | id, class, style, hidden, data-*, latitude | bindregionchange, bindmarkertap, bindtap | 地图占位组件,由宿主地图 provider 提供真实能力。 |
match-media | 布局 | 稳定 | id, class, style, hidden, data-*, min-width | - | 按媒体条件展示内容的响应式容器。 |
modal | 反馈 | 稳定 | id, class, style, hidden, data-*, show | bindtap | 模态弹窗容器。 |
movable-area | 布局 | 稳定 | id, class, style, hidden, data-*, scale-area | bindtap | 可拖拽区域容器。 |
movable-view | 布局 | 稳定 | id, class, style, hidden, data-*, x | bindtap, bindchange, bindtouchstart, bindtouchmove, bindtouchend | 可移动视图,支持位置变化和触摸事件。 |
navbar | 导航 | 稳定 | id, class, style, hidden, data-*, title | bindtap | 页面导航栏组件。 |
navigator | 导航 | 稳定 | id, class, style, hidden, data-*, url | bindtap | 容器内路由跳转组件。 |
page-container | 覆盖层 | 稳定 | id, class, style, hidden, data-*, show | bindtap, bindbeforeenter, bindenter, bindafterenter, bindbeforeleave, bindleave, bindafterleave | 页面级弹出容器,支持进入和离开生命周期事件。 |
picker | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 单列选择器,基于 range 数据选择值。 |
picker-view | 表单 | 稳定 | id, class, style, hidden, data-*, value | bindchange, bindpickstart, bindpickend | 嵌入式滚动选择器。 |
picker-view-column | 表单 | 稳定 | id, class, style, hidden, data-* | - | picker-view 的列容器。 |
progress | 反馈 | 稳定 | id, class, style, hidden, data-*, percent | - | 进度展示组件,百分比会限制在 0 到 100。 |
radio | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 单个单选项。 |
radio-group | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 单选组,将选中项汇总为单个值。 |
rich-text | 内容 | 稳定 | id, class, style, hidden, data-*, nodes | bindtap | 渲染经过安全处理的富文本字符串或节点数组。 |
root-portal | 覆盖层 | 稳定 | id, class, style, hidden, data-* | bindtap | 根层传送容器,用于浮层内容。 |
safe-area | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap | 适配安全区域的布局容器。 |
scroll-view | 布局 | 稳定 | id, class, style, hidden, data-*, scroll-x | bindtap, bindscroll, bindscrolltoupper, bindscrolltolower | 可滚动内容区域。 |
slider | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 滑块控件,返回数值型 event.detail.value。 |
swiper | 布局 | 稳定 | id, class, style, hidden, data-*, current | bindchange | 轮播容器。 |
swiper-item | 布局 | 稳定 | id, class, style, hidden, data-*, item-id | bindtap | 轮播项容器。 |
switch | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindchange | 布尔开关控件。 |
tab | 导航 | 稳定 | id, class, style, hidden, data-*, value | bindtap | 单个标签页项。 |
tabs | 导航 | 稳定 | id, class, style, hidden, data-*, current | bindchange | 标签页组,支持当前项切换。 |
text | 内容 | 稳定 | id, class, style, hidden, data-* | bindtap | 行内文本内容。 |
textarea | 表单 | 稳定 | id, class, style, hidden, data-*, name | bindinput, bindchange, bindconfirm, bindfocus, bindblur | 多行文本输入控件。 |
toast | 反馈 | 稳定 | id, class, style, hidden, data-* | - | 轻量提示展示组件。 |
video | 能力 | 协议优先 | id, class, style, hidden, data-*, id | bindplay, bindpause, bindended, binderror, bindload | 视频播放组件,配合 ac.playMedia 等媒体 API 控制。 |
view | 布局 | 稳定 | id, class, style, hidden, data-* | bindtap, bindtouchstart, bindtouchmove, bindtouchend | 通用布局容器。 |
web-view | 能力 | 协议优先 | id, class, style, hidden, data-*, src | bindload, binderror | 嵌入白名单 HTTPS 页面的小程序内容区域。 |