微信小程序引入扩展组件库

it2025-09-19  2

文档:https://developers.weixin.qq.com/miniprogram/dev/extended/component-plus/

以tabs为例:

引入组件:npm i @miniprogram-component-plus/tabs--save;微信开发者工具点击详情,勾选使用npm模块; 微信开发者工具点击工具–>构建npm;在页面的页面 json 文件中加入 usingComponents 字段;{ "usingComponents": { "mp-tabs": "@miniprogram-component-plus/tabs" } } 页面 wxml 中使用该组件;<mp-tabs tabs="{{tabs}}" activeTab="{{activeTab}}" bindtabclick="onTabCLick" > <block wx:for="{{tabs}}" wx:key="title"> <view class="tab-content" slot="tab-content-{{index}}" > {{item.title}} </view> </block> </mp-tabs>
最新回复(0)