uniapp-模板弹窗

编程入门 行业动态 更新时间:2024-10-25 14:31:30

uniapp-<a href=https://www.elefans.com/category/jswz/34/1770549.html style=模板弹窗"/>

uniapp-模板弹窗

思路:

1.创建静态弹窗按钮键
2.创建显示窗口【图片】

<template><view><!-- 静态样式 --><!-- 打开弹窗 --><view style="padding: 200upx 15%;"><button type="primary" @tap="showBanner">打开弹窗</button></view><!-- 弹出层 --><view  class="uni-banner" style="background:#FFFFFF;" v-if="bannerShow"><!-- x --><view style=" text-align:right;padding:20upx;border: 1upx solid;" @tap="closeBanner"><text>x</text></view><!-- 图 --><view><image src=".jpg" mode="widthFix" style="width:100%;"></image></view><!-- 按钮键 --><view style="margin:50upx 0; margin-bottom:68upx;" ><button type='warn' style="background:#F6644D; margin:0 80upx;">一个按钮</button></view></view><!-- 做黑色阴影颜色 --><view class="uni-mask" v-if="bannerShow"></view><!-- 弹出层 --></view>
</template><script>export default {data() {return {bannerShow:true};},// 监听页面返回onBackPress() {if(this.bannerShow){this.bannerShow = false;return true;}},methods: {closeBanner:function(){this.bannerShow=false;},showBanner:function(){this.bannerShow=true;},}}
</script><style>/* 弹出层形式的广告 */.uni-banner {width: 70%;position: fixed;left: 15%;margin-top: -400upx;z-index: 99;}.uni-mask{z-index: 1;background: rgba(0, 0, 0, 0.6);}
</style>

更多推荐

uniapp-模板弹窗

本文发布于:2023-07-28 16:29:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1250194.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模板   uniapp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!