Skip to content

注册与使用

组件分为原生组件、自定义组件和第三方组件。页面负责组装业务,组件负责可复用的展示与交互单元。

在页面 JSON 中注册自定义组件,再在 WXML 中使用。

json
{
  "usingComponents": {
    "product-card": "/components/product-card/index"
  }
}
xml
<product-card product="{{product}}" bind:select="handleSelect" />

优先使用官方基础组件;引入第三方组件库前评估基础库兼容性、包体积、维护状态与样式方案。

基于 MIT 许可发布