Use sub-assemblies

Use sub-assemblies

In .json the configuration "usingComponents" field, { "tag name": "Path subassembly"}

"usingComponents": {
"x-blog-cart": "/components/blog-cart/blog-cart",
"x-blog-ctrl": "/components/blog-ctrl/blog-ctrl",
},
In use in .wxml
 
 
<view class="detail-footer">
  <x-blog-ctrl
    iconfont="iconfont"
    icon-share="icon-share"
    icon-pinglun="icon-pinglun"
    blogId="{{blog._id}}"
  />
</view>
Parent component subassembly to pass style: The above pink part
Receiving subassembly (in Component ( .jssubassembly has Component package configuration) externalClasses property):
// external style
externalClasses: [
'iconfont',
'icon-share',
'Icon-pinglun'
],
note:
iconfont="iconfont"
icon-share="icon-share"
icon-pinglun="icon-pinglun"
Style transfer
Because of the style isolation, subassemblies want to use a common style, you need to pass
 

Guess you like

Origin www.cnblogs.com/baixinL/p/11988456.html