微信小程序:点击按钮出现右侧弹窗

编程入门 行业动态 更新时间:2024-10-07 12:21:08

微信小程序:点击<a href=https://www.elefans.com/category/jswz/34/1771318.html style=按钮出现右侧弹窗"/>

微信小程序:点击按钮出现右侧弹窗

 效果

代码

wxml

<!-- 弹窗信息 -->
<view class="popup-container" wx:if="{{showPopup}}"><view class="popup-content"><!-- 弹窗内容 --><text>这是一个右侧弹窗</text></view>
</view>
<!-- 遮罩层 -->
<view class="popup-mask"  wx:if="{{showPopup}}" bindtap="hidePopup"></view>
<!-- 点击出现弹窗的按钮 -->
<button bindtap="showPopup">显示弹窗</button>

wxss

.popup-container {position: fixed;top: 0;right: 0;bottom: 0;width: 90%;background-color: #fff;z-index: 9999;border-bottom-left-radius: 15rpx;border-top-left-radius: 15rpx;
}.popup-content {padding: 20rpx;
}.popup-mask {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(0, 0, 0, 0.5);
}

js

Page({data: {showPopup: false},showPopup: function () {this.setData({showPopup: true});},hidePopup: function () {this.setData({showPopup: false});}
});

更多推荐

微信小程序:点击按钮出现右侧弹窗

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

发布评论

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

>www.elefans.com

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