Taro开发写密码支付弹层
在支付的时候弹出填写密码,模仿了支付宝支付填写密码。主要是利用遮罩的来实现。直接上代码吧。
html设计,通过标记控制显示。
{
showPayPwdInput ?
<View className="dialog">
<View className="input_main">
<View className="input_title">
<View className="input_back" onClick={this.hidePayLayer}><Text className="input_backtext"></Text></View>
<Text>输入支付密码</Text>
</View>
<View className="input_row">
{
[0,1,2,3,4,5].map((item,index) => {
return (
<View key={index} className="pwd_item">
{
pwdVal.length>index ? <Text className="pwd_itemtext"></Text> : null
}
</View>
)
})
}
</View>
<View className="forget_pwd" onClick={this.hidePayLayer}>忘记密码</View>
<Input focus={payFocus} password type="number" maxLength="6" onInput={this.inputPwd} className="input_control"></Input>
</View>
</View>
: null
}
js方法。
hidePayLayer = () => {
// e.stopPropagation()
let val = this.state.pwdVal
this.setState({
showPayPwdInput: false,
payFocus: false,
pwdVal: ''
}, () => {
if (val == '123456') {
Taro.showToast({
title: '支付成功'
})
Taro.navigateTo({
url: '/pages/payment/index'
})
}
// Taro.showToast({
// title: val
// })
// console.log(this.state.payFocus)
})
}
inputPwd = (e) => {
this.setState({
pwdVal: e.detail.value
},() => {
if (e.detail.value.length >= 6) {
this.hidePayLayer()
}
})
}
css样式。
.dialog {
width: 100%;
height: 100%;
position: fixed;
left:;
top:;
z-index:;
background: rgba(0,0,0,0.5);
.input_main {
position: fixed; left:; bottom: 500px; width: 100%; height: 394px;
background-color: #fff; z-index:;
.input_title {
width: 100%; height: 90px; line-height: 90px; text-align: center;
font-size: 32px; border-bottom: 2px solid #e2e2e2;
.input_back {
position: absolute; left:; top:;
width: 80px; height: 90px; display: flex; justify-content: center; align-items: center;
.input_backtext {
width: 20px;
height: 20px;
background-color: white;
border: 2px solid #aaa;
border-width: 5px 0 0 5px;
transform: rotate(-45deg);
}
}
}
.input_row {
width: 690px; margin: 0 auto; height: 98px; position: relative;
display: flex; align-items: center; border: 2px solid #cccccc; border-radius: 20px;
.pwd_item{
flex:; display: flex; align-items: center; justify-content: center;
height: 100%; border-right: 2px solid #e2e2e2; position: relative;
.pwd_item:nth-last-of-type(1) { border-right: 0; }
.pwd_itemtext {
width: 30px; height: 30px; border-radius: 30px; background-color: #555;
}
}
}
.forget_pwd {
float: right; margin: 30px; width: 100px; text-align: right; font-size: 24px; color: #ff7800;
}
.input_control {
position: relative; left: -300px; bottom:; width: 100px; height: 100px;
}
}
}
这样就实现了密码输入的实现。
Taro开发写密码支付弹层的更多相关文章
- 弹层组件-layer
layer是Layui的一个弹层组建,功能强大,总之我很喜欢,下面介绍这个组件的基本用法. 首先如果只需要使用layer而不想使用Layui可以单独下载layer组件包,页面引入jquery1.8以上 ...
- jquery layer弹窗弹层插件 小巧强大
/* 先去官网下载最新的js http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id ...
- jquery layer弹窗弹层插件 (转)
/* 先去官网下载最新的js http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id ...
- alert弹层无法取消问题解决办法
最近做H5移动端开发的时候,js代码写了个alert,在Android手机上能正常运行,但是在IOS上运行弹出之后却无法取消掉, 而且页面卡死,点不了任何东西,这种情况是非常不好的,用户体验非常糟糕. ...
- [vuejs] vue2.0-layer-mobile移动端弹层
vue2.0-layer-mobile移动端弹层 本次组件升级支持slot内容分发功能,实现高定制内容风格的弹层 安装方法 npm install vue2-layer-mobile -S 初始化 i ...
- React15.6.0实现Modal弹层组件
代码地址如下:http://www.demodashi.com/demo/12315.html 注:本文Demo环境使用的是我平时开发用的配置:这里是地址. 本文适合对象 了解React. 使用过we ...
- layer 1.9.2 发布,国产 Web 弹层不懈的前行者
快速使用Romanysoft LAB的技术实现 HTML 开发Mac OS App,并销售到苹果应用商店中. <HTML开发Mac OS App 视频教程> 土豆网同步更新:http: ...
- vue3系列:vue3.0自定义全局弹层V3Layer|vue3.x pc桌面端弹窗组件
基于Vue3.0开发PC桌面端自定义对话框组件V3Layer. 前两天有分享一个vue3.0移动端弹出层组件,今天分享的是最新开发的vue3.0版pc端弹窗组件. V3Layer 一款使用vue3.0 ...
- Mybatis(一):手写一套持久层框架
作者 : 潘潘 未来半年,有幸与导师们一起学习交流,趁这个机会,把所学所感记录下来. 「封面图」 自毕业以后,自己先创业后上班,浮沉了近8年,内心着实焦躁,虽一直是走科班路线,但在技术道路上却始终没静 ...
随机推荐
- Delphi 10.2.3
链接: https://pan.baidu.com/s/1Fy2LbcpmujOiqtNZ3ZySOQ 提取码: ts5k
- 用PLSQL DEVELOPER工具简单查找ORACLE中的死锁和死锁排除
用DBA身份登录后 查找死锁: select sess.sid, sess.serial#, lo.oracle_username, lo.os_user_name, ...
- 【rabbitmq】RabbitMQ 集群与网络分区
网络分区(network partitions) 官网-网络分区 网络设备故障导致的网络分裂.比如,存在A\B\C\D\E五个节点,A\B处于同一子网,B\C\D处于另外一子网,中间通过交换机相连.若 ...
- Ubuntu平台rm误删的文件如何恢复
安装:Ubuntu下也可以直接用apt-get来获取extundelete 以我自己的Ubuntu14.04.3来看: df 命令是linux系统上以磁盘分区为单位来查看文件系统的命令,后面可以加上不 ...
- MongoDB中的读写锁
1. MongoDB 使用的锁 MongoDB 使用的是“readers-writer”锁, 可以支持并发但有很大的局限性当一个读锁存在,许多读操作可以使用这把锁,然而, 当一个写锁的存在,一个单一的 ...
- 使用iptables基于MAC地址进行访控
近日完成一台基于CentOS的SVN服务器配置,由于该服务器上的文件非常重要,仅部分用户需要访问,最后决定采用iptables来做访控,并且是根据MAC地址来限制,为了便于后期维护,防火墙的配置是通过 ...
- Qt文件系统之QFile
QFile文件操作 文件打开方式: QIODevice::NotOpen 0x0000 设备不打开.QIODevice::ReadOnly 0x0001 设备 以只读的方式打开.Q ...
- boolean表达式与在if条件中的运用
1.boolean语句 boolean 类型的数据 有两个值 false 和true; 2.在if判断的条件语句中 例如: boolean arn =false 在if 判断的括号中可以表示为 !a ...
- ssh 公钥无秘登录问题
1. 验证服务启动,网络端口连接正常 可以使用nc,telnet,或者密码模式的ssh来验证 2. 验证ssh client端的配置正确 可以尝试登录另外一台主机, 或者本机自校验 3. 验证ssh ...
- css常见布局问题
1.如何实现一个盒子在页面中上下左右居中 方法一:(盒子宽高固定时) .box{ width:400px; height:200px; background:#000; position:absolu ...