温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

小程序popupwindow弹出框怎么实现

发布时间:2021-01-28 10:48:20 阅读:229 作者:小新 栏目:移动开发
Windows服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

小编给大家分享一下小程序popupwindow弹出框怎么实现,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

小程序popupwindow弹出框的实现代码

在上方弹出

小程序popupwindow弹出框怎么实现

wxml

<view class="zan-dialog {{ showDialog ? 'zan-dialog--show' : '' }}">
  <view class="zan-dialog__mask" bindtap="toggleDialog" />
  <view class="zan-dialog__container">
    <view style="padding: 100px 0; text-align: center;">Dialog内容</view>
  </view></view>

wcss

.zan-dialog__mask {
  position: fixed;  
  top0;  left0;  
  right0;  
  bottom0;  
  z-index10;  
  backgroundrgba(0000.4);  
  display: none;
  }
.zan-dialog__container {
  position: fixed;  
  top0;  
  width750rpx;  
  background: white;  
  transformtranslateY(-150%);  
  transition: all 0.4s ease;  
  z-index12;
  }
.zan-dialog--show .zan-dialog__container {
  transformtranslateY(0);
  }
.zan-dialog--show .zan-dialog__mask {
  display: block;
  }

js

Page({  data: {    showDialog: false
  },//控制 pop 的打开关闭
  toggleDialog() {
    this.setData({
      showDialog: !this.data.showDialog
    });

  },

})

在下方弹出

wxml

  <view class="zan-dialog {{ showDialog ? 'zan-dialog--show' : '' }}">
    <view class="zan-dialog__mask" bindtap="toggleDialog" />
    <view class="zan-dialog__container">
      <view style="padding: 100px 0; text-align: center;">Dialog内容</view>
    </view>
  </view>

wcss

.zan-dialog__mask {
  position: fixed;  
  top0;  
  left0;  
  right0;  
  bottom0;  
  z-index10;  
  backgroundrgba(0000.4);  
  display: none;
  }
.zan-dialog__container {
  position: fixed;  
  bottom0;  
  width750rpx;  
  background: white;  
  transformtranslateY(150%);  
  transition: all 0.4s ease;  
  z-index12;
  }
.zan-dialog--show .zan-dialog__container {
  transformtranslateY(0);
  }
.zan-dialog--show .zan-dialog__mask {
  display: block;
  }

js

Page({  data: {    showDialog: false
  },//控制 pop 的打开关闭
  toggleDialog() {
    this.setData({
      showDialog: !this.data.showDialog
    });

  },

})

看完了这篇文章,相信你对“小程序popupwindow弹出框怎么实现”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×