• 小程序展开收起


    效果图:

    js:

    // 获取全局应用程序实例对象
    var app = getApp();
    
    // 创建页面实例对象
    Page({
      /**
       * 页面的初始数据
       */
      data: {
        isShow: false, //控制收起展开
        },//控制收起展开
         toChange: function () {
        let that = this;
        that.setData({
          isShow: !that.data.isShow
        })
      },
    });

    wxml:

    <view class="container">
        <view class="title">
            <text class="title_txt">消费详情</text>
            <image class="title_icon" src="{{isShow ? 'https://file.snailpet.cn/23/a4/23a4787efd85b48db2102dcb51735e2c.png' : 'https://file.snailpet.cn/03/ad/03addd057eb67d09feef31894762d7f2.png'}}" bindtap="toChange"/>
        </view>
        <view class="{{isShow? 'on':'content'}}">
            <view class='cost flex-colum lr-padding'>
                <view class='goods-cost flex-row'>
                    <text class='cost-title text666-color'>共消费</text>
                    <text class='cost-detail tl-color-186 text-r text-over-ell'><!--团满50件应退款--><text class='main-color cost-m tl-color-186'>¥200</text></text>
                </view>
                <view class='goods-cost flex-row'>
                    <text class='cost-title text666-color'>优惠金额</text>
                    <text class='cost-detail tl-color-186 text-r text-over-ell'><text class='main-color cost-m tl-color-186'>¥50</text></text>
                </view>
                <view class='goods-cost flex-row'>
                    <text class='cost-title text666-color'>苹果</text>
                    <text class='cost-detail text666-color text-r text-over-ell'>合计:<text class='main-color cost-m tl-color-186'>¥75</text></text>
                </view>
                <view class='goods-cost flex-row'>
                    <text class='cost-title text666-color'>香蕉</text>
                    <text class='cost-detail text666-color text-r text-over-ell'>合计:<text class='main-color cost-m tl-color-186'>¥75</text></text>
                </view>
            </view>
        </view>
    </view>

    wxss:

    .container .title {
         display: flex;
         flex-direction: row;
         justify-content: space-between;
         align-items: center;
         padding: 25rpx;
    }
    .container .title_txt {
        font-size: 34rpx;
        color: #2b2b2b;
    }
    .container .title_icon {
        display: block;
         21rpx;
        height: 11rpx;
    }
    
    .content{
        height: 80rpx;
        overflow: hidden;
        text-overflow: ellipsis;
        text-overflow: -o-ellipsis-lastline;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        padding: 0 25rpx;
        font-size: 30rpx;
        color: #888888;
    }
    .on{
        display: block;
        text-overflow: clip;
        overflow: visible;
    }
  • 相关阅读:
    (转)Linux下/etc/rc.local与/etc/init.d的区别与联系
    (转)谈免驱
    (转)获取android源码时repo的错误
    (转)platform_driver_register,什么时候调用PROBE函数 注册后如何找到驱动匹配的设备
    (转)typedef 函数指针的用法
    (转)分析kernel的initcall函数
    (转)Tiny210v2( S5PV210 ) 平台下 FIMD 对应 的 framebuffer 驱动中,关于 video buffer 的理解
    tiny210V2开发板hdmi输出到10.1寸LCD,无图像
    (转)学习linux的几本书
    (转)RGB接口和i80接口的区别
  • 原文地址:https://www.cnblogs.com/bin521/p/11212657.html
Copyright © 2020-2023  润新知