1、配合view使用
<view wx:if="{{boolean==true}}">
    <view class="red"></view>
</view>
<view wx:elif="{{boolean==false}}">
    <view class="yellow"></view>
</view>
<view wx:elif>
    <view class="blue"></view>
</view>
2、配合block使用
<block wx:if="{{boolean==true}}">
    <view class="red"></view>
</block>
<block wx:elif="{{boolean==false}}">
    <view class="yellow"></view>
</block>
<block wx:else>
    <view class="blue"></view>
</block>

这些是比较常用的,像比较常见的判断游客模式和用户模式,相同的列表,游客模式的一部分不展示出来一样,类似于这样的情况使用wx:if elif else语法,会很好的解决这个问题,大家有木有学到呢?

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-04-18
  • 2021-07-06
  • 2022-12-23
猜你喜欢
  • 2021-10-09
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2021-08-04
  • 2021-12-31
  • 2021-11-20
相关资源
相似解决方案