NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
1. 子元素js中开启slot功能 ``` options: { multipleSlots: true }, ``` 2. 子组件使用slot标签预留元素位置,等待父元素写入 ``` --tag.html-- <view class="tag tag-class"> <text>{{comment}}</text> <slot name="num"></slot>//预留slot元素位置 </view> ``` 3. 父元素写入 ``` --index-- <v-tag comment="{{item.comment}}" tag-class="{{index==0?'bg':''||index==1?'bg1':''}}"> <view slot="num" class="num"> //将该view写入名为num的slot +{{item.num}} </view> </v-tag> ```