当前位置:首页站长学院后端开发小程序popupwindow弹出框的实现代码
企业营销,就选知企PROSAAS

小程序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;  
  top: 0;  left: 0;  
  right: 0;  
  bottom: 0;  
  z-index: 10;  
  background: rgba(0, 0, 0, 0.4);  
  display: none;
  }
.zan-dialog__container {
  position: fixed;  
  top: 0;  
  width: 750rpx;  
  background: white;  
  transform: translateY(-150%);  
  transition: all 0.4s ease;  
  z-index: 12;
  }
.zan-dialog--show .zan-dialog__container {
  transform: translateY(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;  
  top: 0;  
  left: 0;  
  right: 0;  
  bottom: 0;  
  z-index: 10;  
  background: rgba(0, 0, 0, 0.4);  
  display: none;
  }
.zan-dialog__container {
  position: fixed;  
  bottom: 0;  
  width: 750rpx;  
  background: white;  
  transform: translateY(150%);  
  transition: all 0.4s ease;  
  z-index: 12;
  }
.zan-dialog--show .zan-dialog__container {
  transform: translateY(0);
  }
.zan-dialog--show .zan-dialog__mask {
  display: block;
  }

js

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

  },

})

相关推荐:

在微信小程序里添加弹出对话框

微信小程序使用modal组件弹出对话框实例分享

以上就是小程序popupwindow弹出框的实现代码的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:小程序popupwindow弹出框的实现代码

文章链接:https://ceshi.prosaas.cn/17064.html

更新时间:2018年09月06日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
后端开发

小程序中canvas的拖拽功能详解

2018-9-6 9:36:25

后端开发

微信小程序中自定义分享按钮的实现过程

2018-9-6 10:02:08

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索