首页 - 微信小程序

微信小程序wx:if与wx:else多条件判断

wx:if 多条件判断
<view wx:if="{{condition}}">单个条件</view>
<view wx:if="{{condition1|| condition2}}">多个或条件</view>
<view wx:if="{{condition1&& condition2}}">多个且条件</view>

wx:if else 的判断
<view wx:if="{{a>5}}">6</view>
<view wx:elif="{{a < 5}}">4</view>
<view wx:else>5</view>

 另一种
<view  wx:if="{{sex == '1'}}">男</view>
<view wx:elif="{{sex=='0'}}">女</view>
<view wx:else>不男不女</view>