1 <template name="objectCombine"> 2 <view> 3 <text> {{for}} </text> 4 <text> {{bar}} </text> 5 </view> 6 </template> 7 8 <template name="objectCombine"> 9 <view> 10 <text> {{a}} </text> 11 <text> {{b}} </text> 12 <text> {{c}} </text> 13 <text> {{d}} </text> 14 </view> 15 </template> 16 <text> 使用对象 </text> 17 <template is="objectCombine" data="{{for: a, bar: b}}"> </template> 18 19 <text> 对象展开 </text> 20 <template is="objectCombine2" data="{{...obj1, ...obj2, e: 5}}"> </template> 21 22 23 条件渲染: 24 <view wx:if="{{length > 1}}"> 1 </view> 25 <view wx:elif="{{length > 2}}" > 2 </view> 26 <view wx:else> 3 </view> 27 28 <block wx:if="{{length >1 }}""> 29 <view> 1 </view> 30 <view> 2 </view> 31 </block>