这是父页面WXML代码 获取组件
<swiper circular="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="red" autoplay="true" interval="3000" easing-function="easeInOutCubic"> <swiper-item wx:for="{{img}}" wx:key="index"> <compA rItem="{{item}}"></compA> </swiper-item> </swiper>
从json中
{ "usingComponents": { "compA":"/components/compA/compA", "compB":"/components/compB/compB" } }
组件的wxml
<image src="{{rItem.image}}" bindtap="handle"></image>
组件的js代码 接收rItem
properties: { rItem: { type: Object, value: {} } },