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

UNI-APP弹窗

 组件代码

<template><view><!-- 蒙版 --><view class="mask" @click="close()" v-show="tanchuang"></view><!-- 弹窗 --><view class="pop" :style="{height:height*0.8 + 'px',top:tanchuang?height*0.2 + 'px':height + 'px'}"><!-- 头部 --><view class="" style="width: 100%;" @click="close()"><view class="huaxian"></view></view><!-- 内容 --><scroll-view scroll-y="true" :style="{maxHeight: `${scrollHeight}px`}"><slot></slot></scroll-view></view></view>
</template><script>let systemInfo = uni.getSystemInfoSync();export default {name: "pop-up",props: {tanchuang: {type: Boolean,default: false}},data() {return {height: systemInfo.screenHeight,scrollHeight: systemInfo.screenHeight * 0.8 - uni.upx2px(100),};},methods: {close() {this.$emit('close');},}}
</script><style lang="scss">/* 划线 */.huaxian {height: 10rpx;width: 200rpx;background: #bbbbbb;border-radius: 100rpx;margin: auto;margin-top: 30rpx;margin-bottom: 30rpx;}/* 蒙版 */.mask {z-index: 998;position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(0, 0, 0, 0.5);}/*  */.pop {position: fixed;// width: 750rpx;background-color: #fff;border-radius: 30rpx 30rpx 0 0;left: 0;right: 0;transition-property: top;transition-duration: 150ms;transition-timing-function: ease-in-out;z-index: 999;.title {padding: 30rpx 30rpx 0;align-items: center;justify-content: center;line-height: 40rpx;}&--close-btn {height: 40rpx;width: 40rpx;position: absolute;right: 30rpx;top: 30rpx;}}.border-bottom {width: 750rpx;border-bottom: 1rpx solid #e8e8e8;transform: scaleY(.5);margin-top: 30rpx;}
</style>

 组件的使用

<template><view><button @click="tanchuang = true">打开</button><pop-up :tanchuang="tanchuang" @close="tanchuang = false"><view class="article-list">弹窗内容</view></pop-up></view>
</template><script>export default {data() {return {tanchuang: false}},methods: {}}
</script><style></style>

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

相关文章:

  • 【大模型实战篇】LLaMA Factory微调ChatGLM-4-9B模型
  • 【Cesium】三、实现开场动画效果
  • #渗透测试#红蓝攻防#红队打点web服务突破口总结01
  • 适用于项目经理的跨团队协作实践:Atlassian Jira与Confluence集成
  • 智能家居体验大变革 博联 AI 方案让智能不再繁琐
  • 云计算与服务是什么
  • 接口测试面试题
  • 【Cesium】六、实现鹰眼地图(三维)与主图联动效果
  • ESLint+Prettier的配置
  • 4.微服务灰度发布落地实践(消息队列增强)
  • 【从零开始入门unity游戏开发之——C#篇35】C#自定义类实现Sort自定义排序
  • 音频进阶学习九——离散时间傅里叶变换DTFT
  • 连接github和ai的桥梁:GitIngest
  • Pytorch使用手册-DCGAN 指南(专题十四)
  • Flume的安装和使用
  • [Hive]七 Hive 内核
  • Druid密码错误重试导致数据库超慢
  • Ubuntu 24.04安装和使用WPS 2019
  • week05_nlp大模型训练·词向量文本向量
  • 【RabbitMQ消息队列原理与应用】
  • 反欺诈风控体系及策略
  • Mac 12.1安装tiger-vnc问题-routines:CRYPTO_internal:bad key length
  • 【代码分析】Unet-Pytorch
  • 【LLM入门系列】01 深度学习入门介绍
  • 安卓系统主板_迷你安卓主板定制开发_联发科MTK安卓主板方案
  • 关键点检测——HRNet原理详解篇
  • 25考研总结
  • 网络安全态势感知
  • 在K8S中,节点状态notReady如何排查?
  • 深度学习在光学成像中是如何发挥作用的?