• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

fixed实现遮罩层,小程序

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

css

/** 分享微信,分享朋友圈 **/
.goods_share_mask {
  background-color: rgba(0, 0, 0, 0.3);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999;
  transition: transform 0.3s ease-in-out;
  .goods_share_box {
    border-radius: 10px 10px 0px 0px;
    height: 370rpx;
    background-color: white;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    .title {
      text-align: center;
      width: 750rpx;
      height: 106rpx;
      line-height: 106rpx;
      font-size: 30rpx;
      font-weight: bold;
      color: rgba(69, 69, 69, 1);
      border-bottom: 1px solid #dddddd;
      position: relative;
      .close_icon {
        position: absolute;
        width: 20rpx;
        height: 20rpx;
        top: 40rpx;
        right: 30rpx;
      }
    }
    .content {
      height: 263rpx;
      display: flex;
      .item {
        width: 375rpx;
        text-align: center;
        display: flex;
        flex-direction:column;
        .img {
          width: 80rpx;
          height: 80rpx;
          margin-top: 70rpx;
        }
        .text {
          font-size: 24rpx;
          font-weight: bold;
          color: rgba(130, 130, 130, 1);
        }
      }
    }
  }
}

.goods_share_mask_hidden {
    @extend .goods_share_mask;
    transform: translateY(100%);
    visibility: hidden;
}

html

<!-- 弹出层 -->
<view class="{{hiddenWxShare ? \'goods_share_mask_hidden\' : \'goods_share_mask\'}}" catch:tap="closeWxShare" catch:touchmove="_stopTap">
    <!-- 内容层 -->
    <view class="goods_share_box" catch:tap="_stopTap">
        <view class="title">
            分享至
            <image class=\'close_icon\' src="/images/share/close.png" catch:tap="closeWxShare"></image>
        </view>

        <view class="content">
            <view class="item">
                <view>
                    <image class=\'img\' src="/images/share/wx.png"></image>
                </view>
                
                <text class="text">微信好友</text>
            </view>
            <view class="item">
                <view>
                <image class=\'img\' src="/images/share/friend.png"></image>
                </view>
                <text class="text">微信朋友圈</text>
            </view>
        </view>
    </view>
</view>  

js

Page({
  data: {
    hiddenWxShare: true,
  },
  _stopTap() {
    return;
  },
  closeWxShare() {
    this.setData({ hiddenWxShare: true });
  },
  showWxShare() {
    this.setData({ hiddenWxShare: false });
  }
});

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
同城小程序商城开发详解发布时间:2022-07-18
下一篇:
小程序“功能直达”内测,你读懂了什么?发布时间:2022-07-18
热门推荐
    热门话题
    阅读排行榜

    扫描微信二维码

    查看手机版网站

    随时了解更新最新资讯

    139-2527-9053

    在线客服(服务时间 9:00~18:00)

    在线QQ客服
    地址:深圳市南山区西丽大学城创智工业园
    电邮:jeky_zhao#qq.com
    移动电话:139-2527-9053

    Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap