<block wx:if="{{true}}">
<view> view1 </view>
<view> view2 </view>
</block>
Is there any difference between and the following one?
<view wx:if="{{true}}">
<view> view1 </view>
<view> view2 </view>
</view>
<block wx:if="{{true}}">
<view> view1 </view>
<view> view2 </view>
</block>
Is there any difference between and the following one?
<view wx:if="{{true}}">
<view> view1 </view>
<view> view2 </view>
</view>
< block > is not a component, it's just a wrapper element, it doesn't render anything in the page, it only accepts control attributes.
render result:
<view> view1 </view>
<view> view2 </view>
<view wx:if="{{true}}">
<view> view1 </view>
<view> view2 </view>
</view>
< view > is a component that renders on the page; < block > is not a component, it is only a wrapper element, accepts only control attributes, and does not render anything in the page
, which is the same as react's Fragments effect
.