微信小程序怎么实现输入支付密码demo
发表于:2025-02-11 作者:千家信息网编辑
千家信息网最后更新 2025年02月11日,这篇文章主要介绍了微信小程序怎么实现输入支付密码demo 的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇微信小程序怎么实现输入支付密码demo 文章都会有所收获,下面我们
千家信息网最后更新 2025年02月11日微信小程序怎么实现输入支付密码demo
这篇文章主要介绍了微信小程序怎么实现输入支付密码demo 的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇微信小程序怎么实现输入支付密码demo 文章都会有所收获,下面我们一起来看看吧。
微信小程序开发实现微信支付密码的输入,要解决:
1、小程序要想唤起键盘,必须要借助input控件。通过input控件和其属性focus来唤起和隐藏输入键盘。
2、要让input控件不可见。让光标和输入的字符都不可见,这里是把input控件定位到左边不可见范围。
实现demo代码:
1、页面代码
立即支付 输入支付密码 使用会员卡余额支付需要验证身份,验证通过后才可进行支付。 忘记密码
2、js代码
//index.js//获取应用实例const app = getApp() Page({data: {showPayPwdInput: false, //是否展示密码输入层pwdVal: '', //输入的密码payFocus: true, //文本框焦点},onLoad: function () {this.showInputLayer();},/*** 显示支付密码输入层*/showInputLayer: function(){this.setData({ showPayPwdInput: true, payFocus: true });},/*** 隐藏支付密码输入层*/hidePayLayer: function(){ var val = this.data.pwdVal; this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, function(){wx.showToast({title: val,})}); },/*** 获取焦点*/getFocus: function(){this.setData({ payFocus: true });},/*** 输入密码监听*/inputPwd: function(e){this.setData({ pwdVal: e.detail.value }); if (e.detail.value.length >= 6){this.hidePayLayer();}}})
3、样式
.btn_pay{margin: 100rpx auto; width: 600rpx; height: 100rpx; line-height: 100rpx; border-radius: 100rpx;background-color: #d3a95a; color: #fff; font-size: 36rpx; text-align: center;}/* 支付密码css start */.bg_layer{position: fixed; left: 0; top: 0; bottom: 0; right: 0;background-color: rgba(0, 0, 0, 0.6); z-index: 9998;}.input_main{position: fixed; left: 0; bottom: 500rpx; width: 100%; height: 394rpx;background-color: #fff; z-index: 9999;}.input_title{width: 100%; height: 90rpx; line-height: 90rpx; text-align: center;font-size: 32rpx; border-bottom: 1rpx solid #e2e2e2;}.input_back{position: absolute; left: 0; top: 0;width: 80rpx; height: 90rpx; display: flex; justify-content: center; align-items: center;}.input_back text{width: 20rpx;height: 20rpx;background-color: white;border: 1rpx solid #aaa;border-width: 5rpx 0 0 5rpx;transform: rotate(-45deg);} .input_tip{ margin: 30rpx; font-size: 24rpx; color: #888; } /* 密码掩码模拟 */.input_row{width: 690rpx; margin: 0 auto; height: 98rpx; position: relative;display: flex; align-items: center; border: 1rpx solid #e2e2e2; border-radius: 20rpx;}.input_row .pwd_item{flex: 1; display: flex; align-items: center; justify-content: center;height: 100%; border-right: 1rpx solid #e2e2e2; position: relative;}.pwd_item:nth-last-of-type(1) { border-right: 0; }.pwd_item text {width: 30rpx; height: 30rpx; border-radius: 30rpx; background-color: #555;} .forget_pwd{float: right; margin: 30rpx; width: 100rpx; text-align: right; font-size: 24rpx; color: #ff7800;} /* 文本输入框位置: 设置到左边隐藏 */.input_control {position: relative; left: -300rpx; bottom: 0; width: 100rpx; height: 100rpx;}
关于"微信小程序怎么实现输入支付密码demo "这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对"微信小程序怎么实现输入支付密码demo "知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。
密码
输入
支付
程序
控件
代码
知识
内容
文本
焦点
篇文章
键盘
验证
价值
会员
会员卡
位置
余额
光标
字符
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
服务器网络数据异常
有什么新兴网络技术
数据库的应用程序名称设置
java抢票软件开发
奉贤区网络技术开发供应商
华为高斯数据库中标国家机关
互联网科技创新股票
vfp数据库技术
网络安全类的毕业设计题目
公益科技的互联网种树模式
首次软件开发深圳政府补助
高斯数据库技术技巧
网络技术毕业送什么礼物
重庆正规软件开发应用
网络安全画画简单又漂亮
cmd数据库查找
gprs 与服务器通信
卢龙服务器里北京多远
杀手的我的世界服务器
湖北app软件开发定制
服务器直通模式好处
网络安全领域把已经发现
常见的网络安全防护措施
主要通用网络安全技术
上海远程医疗健康软件开发
保密工作网络安全管理
网络安全整治的主要任务包括
中国首个网络安全标准
无锡建讯互联网科技有限公司
mysql数据库cpu升高