微信小程序学习之externalClasses的用法
外部样式类用法:
一.自定义子组件:
1. tag/index.wxml:
在class类名里写入需要的外部样式类
<viewclass="tag-class"></view>
2.tag/index.js
Component({externalClasses:['tag-class']})
二.页面上引入组件
1.detail.json:
"usingComponents":{"tag-cmp":"/components/tag/index",}
2.detail.wxml
在父组件的标签上写入子组件externalClasses配置项传入的值作为css的class类名称
<tag-cmptag-class="tag"></tag-cmp>
3.detail.wxss
.tag{margin-right:15rpx;margin-bottom:10rpx;border-radius:15px!important;}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。