zoukankan      html  css  js  c++  java
  • 小程序_底部弹出层

    wxml:

    <view bindtap='showModal'>点击弹出</view>
    <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view>
    <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}">
    <text>我是弹出层的内容</text>
    </view>

    wxss:

    .commodity_screen {
       100%;
      height: 100%;
      position: fixed;
      top: 0;
      left: 0;
      background: #000;
      opacity: 0.5;
      overflow: hidden;
      z-index: 9;
      color: #fff;
    }
    
    .commodity_attr_box {
       100%;
      overflow: hidden;
      position: fixed;
      bottom: 0;
      left: 0;
      z-index: 10;
      background: #fff;
      padding-top: 20rpx;
      height: 300px;
    }
    .commodity_attr_box{
      text-align: center;
      padding-top: 100rpx;
    }

    js:

    Page({
      data: {
        showModalStatus: false,
        animationData: ''
      },
      onLoad: function () {
       
      },
      showModal: function () {
        // 显示遮罩层
        var animation = wx.createAnimation({
          duration: 200,
          timingFunction: "ease-in-out",
          delay: 0
        })
        this.animation = animation
        animation.translateY(500).step()
        this.setData({
          animationData: animation.export(),
          showModalStatus: true
        })
        setTimeout(function () {
          animation.translateY(0).step()
          this.setData({
            animationData: animation.export()
          })
        }.bind(this), 200)
      },
      hideModal: function () {
        this.setData({
          showModalStatus: false,
        })
      
      }
    })
  • 相关阅读:
    html04
    html03
    html02
    html01
    通过脚本获取form表单的数值而不是submit
    myeclipse自带的数据库查看文件
    如何实现数组和List之间的转换?
    Array和ArrayList有何区别?
    ArrayList和LinkedList的区别是什么?
    如何决定使用HashMap还是TreeMap?
  • 原文地址:https://www.cnblogs.com/wush-1215/p/9474439.html
Copyright © 2011-2022 走看看