zoukankan      html  css  js  c++  java
  • 小程序中条件渲染用法

     

    有时完善内容显示需要不同条件显示不同内容

    用到了WX:if

            <text class="comments-title">最新评论</text>

            <view class="comments-box" wx:if="{{comments.length > 0}}">

                <view class="comments-list" wx:for="{{comments}}" wx:for-item="item" wx:for-index="i">

                    <view class="comments-avatar"><image class="comments-avatar-img" src="{{item.avatar}}"/></view>

                    <view class="comments-main">

                        <view class="comments-author">

                            <view class="comments-zan">{{item.likes}}</view>

                            <text>{{item.author}}</text>

                        </view>

                        <view class="comments-content">{{item.content}}</view>

                        <view class="comments-data">{{item.times}}</view>

                    </view>

                </view>

            </view>

            <!-- 没有评论 -->

            <view class="not-comments" wx:else> 暂时还没有评论喔! </view>

     

    文章来源:刘俊涛的博客

    地址:http://www.cnblogs.com/lovebing

    欢迎关注,有问题一起学习欢迎留言、评论。

  • 相关阅读:
    lvs实现故障转移(backup)
    shell计算
    CEGUI 聊天对话框
    SetRenderState 设置渲染状态【转】
    MFC 弹出对话框
    DrawIndexedPrimitive函数的详细解释【转】
    IDirect3DDevice9::Clear 【转】
    manifest 文件错误
    D3DXMatrixLookAtLH 【转】
    D3D中的网格(Mesh)
  • 原文地址:https://www.cnblogs.com/lovebing/p/9414971.html
Copyright © 2011-2022 走看看