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

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

  • 相关阅读:
    hdu 2106 decimal system
    00-自测4. Have Fun with Numbers (20)
    07-图4. Saving James Bond
    hdu 2209 翻纸牌游戏
    hdu 1272 小希的迷宫
    1969 Pie
    怎样维护 SQLite
    Navicat使用亮点
    Navicat for MySQL 11 Mac安装教程
    Navicat for PostgreSQL 运算符有哪些类别
  • 原文地址:https://www.cnblogs.com/lovebing/p/9414971.html
Copyright © 2011-2022 走看看