当前位置: 首页 > news >正文

原生实现底部弹窗效果 h5 小程序

 

<template><div class="home"><div class="btn" @click="showPopup='show'">弹出底部蒙层</div><div class="popup " catchtouchmove="true" :class="showPopup" ><div class="mask"></div><div class="layer attr-content"><div class="close" @click="closePopup">关闭</div></div></div></div>
</template>
<script>
export default{data(){return{showPopup:'none'}},methods:{closePopup(){this.showPopup = 'hide';setTimeout(() => {this.showPopup = 'none';}, 250);}}
}
</script>

 

<style lang="scss" scoped>
.btn{width:200px;height:50px;text-align: center;line-height: 50px;font-size:16px;position: fixed;left:50%;top:40%;transform: translateX(-50%);cursor: pointer;
}.popup {position: fixed;left: 0;top: 0;right: 0;bottom: 0;z-index: 999;overflow: hidden;&.show {display: block; }   .close{width:100px;height:50px;font-size: 16px;line-height: 50px;text-align: center;}&.hide {.mask {animation: hidePopup 0.2s linear both;}.layer {animation: hideLayer 0.2s linear both;}}&.none {display: none;}.mask {position: fixed;top: 0;width: 100%;height: 100%;z-index: 1;background-color: rgba(0, 0, 0, 0.3);animation: showPopup 0.2s linear both;}.layer {display: flex;width: 100%; flex-direction: column;min-height: 40vh;max-height: 1014rpx;position: fixed;z-index: 99;bottom: 0;border-radius: 10upx 10upx 0 0;background-color: #fff;animation: showLayer 0.2s linear both;}
}
@keyframes showPopup {0% {opacity: 0;}100% {opacity: 1;}
}@keyframes hidePopup {0% {opacity: 1;}100% {opacity: 0;}
}@keyframes showLayer {0% {transform: translateY(120%);}100% {transform: translateY(0%);}
}@keyframes hideLayer {0% {transform: translateY(0);} 100% {transform: translateY(120%);     }
}
</style>

http://www.lryc.cn/news/243030.html

相关文章:

  • 最新Midjourney绘画提示词Prompt教程无需魔法
  • 大一统模型 Universal Instance Perception as Object Discovery and Retrieval 论文阅读笔记
  • java springboot测试类虚拟MVC环境 匹配返回值与预期内容是否相同 (JSON数据格式) 版
  • react等效memo的方法
  • 2023年亚太杯数学建模A题解题思路(*基于OpenCV的复杂背景下苹果目标的识别定位方法研究)
  • 【机器学习】聚类(三):原型聚类:高斯混合聚类
  • 线上ES集群参数配置引起的业务异常案例分析
  • 【Docker】Docker 仓库管理和Docker Dockerfile
  • 面试必问:如何快速定位BUG?BUG定位技巧及N板斧!
  • 力扣114. 二叉树展开为链表(java,用树模拟链表)
  • 学生成绩管理系统(python实现)
  • 【Leetcode合集】1410. HTML 实体解析器
  • 04-React脚手架 集成Axios
  • 时序预测 | MATLAB实现基于BiLSTM-AdaBoost双向长短期记忆网络结合AdaBoost时间序列预测
  • 【nlp】3.6 Tansformer模型构建(编码器与解码器模块耦合)
  • 【【Linux系统下常用指令学习 之 二 】】
  • Git-将指定文件回退到指定版本
  • docker环境安装
  • 【Java】智慧工地云平台源码(APP+SaaS模式)
  • 2016年11月10日 Go生态洞察:七年的Go语言旅程
  • 深入了解Java中SQL优化的关键技巧与实践
  • 6.3.WebRTC中的SDP类的结构
  • ArcGis如何用点连线?
  • 自定义精美商品分类列表组件 侧边栏商品分类组件 category组件(适配vue3)
  • 造一个float类型二维矩阵,并将二维矩阵存快速储到一个float*中(memcpy)
  • python通过继承、组合、委托组织类
  • OSG粒子系统与阴影-自定义粒子系统示例<1>(4)
  • 激活函数与其导数:神经网络中的关键元素
  • 微信公众号对接获取用户openid预约项目心路全历程
  • 大中小协作 共筑科学梦——华中科技大学附属花城中学举办首届科技节