多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ### 1. 在组件文件中 创建卡槽 ~~~ <view class="container tag-class"> <text>{{comment}}</text> <slot name="after"></slot> </view> ~~~ ### 2. 在组件的js中声明 ~~~ options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, ~~~ ### 3. 父组件的json中注册 ~~~ { "usingComponents": { "v-tag":"/components/tag/index" } } ~~~ ### 4. 使用 将wxml传给子组件 通过相同的 slot="after" ~~~ <v-tag comment="{{item.comment}}" > <text slot="after" class="num">+{{item.num}}</text> </v-tag> ~~~