小程序,红包弹出层布局


html

<!-- 弹出层 -->
<view class="{{hiddenMask ? 'common_mask_hidden' : 'common_mask'}}" catch:tap="closeMask" catch:touchmove="_stopTap">
    <!-- 内容层 -->
    <view class="mask_box">
        <view class="content" catch:tap="_stopTap">
            <view class="bg-box">
                <image class="bg-img" src="/images/index/packet_bg.png" />
                <view class="do-box">
                    <image class="do-img" src="/images/index/packet_do.png" />
                    <image class="do-img" src="/images/index/packet_do.png" />
                    <image class="do-img" src="/images/index/packet_do.png" />
                </view>
            </view>
            <view class="close-box" catch:tap="closeMask">
                <image class="close-img" src="/images/index/packet_close.png" />
            </view>
        </view>
    </view>
</view>

css

/** 弹出核销码 **/
.common_mask {
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999;
  transition: transform 0.3s ease-in-out;
  .mask_box {
    // 控制垂直居中
    display: flex;
    align-items: center;
    height: 100%;

    .content {
      // 控制水平居中
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      .bg-box {
        .bg-img {
          width: 672rpx;
          height: 429rpx;
        }
        position: relative;
        .do-box {
          position: absolute;
          top:165rpx;
          left:76rpx;
          // background-color: blue;
          margin:0 auto;
          width: 520rpx;
          display: flex;
          justify-content: space-between;
          .do-img {
            width: 150rpx;
            height: 200rpx;
          }
        }
      }

      .close-box {
        text-align: center;
        .close-img {
          width: 62rpx;
          height: 85rpx;
        }
      }
    }
  }
}

.common_mask_hidden {
  @extend .common_mask;
  transform: translateY(100%);
  visibility: hidden;
}
posted @ 2020-05-25 10:26  TBHacker  阅读(668)  评论(0编辑  收藏  举报