在支付的时候弹出填写密码,模仿了支付宝支付填写密码。主要是利用遮罩的来实现。直接上代码吧。

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开发写密码支付弹层的更多相关文章

  1. 弹层组件-layer

    layer是Layui的一个弹层组建,功能强大,总之我很喜欢,下面介绍这个组件的基本用法. 首先如果只需要使用layer而不想使用Layui可以单独下载layer组件包,页面引入jquery1.8以上 ...

  2. jquery layer弹窗弹层插件 小巧强大

    /* 先去官网下载最新的js  http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id ...

  3. jquery layer弹窗弹层插件 (转)

    /* 先去官网下载最新的js  http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id ...

  4. alert弹层无法取消问题解决办法

    最近做H5移动端开发的时候,js代码写了个alert,在Android手机上能正常运行,但是在IOS上运行弹出之后却无法取消掉, 而且页面卡死,点不了任何东西,这种情况是非常不好的,用户体验非常糟糕. ...

  5. [vuejs] vue2.0-layer-mobile移动端弹层

    vue2.0-layer-mobile移动端弹层 本次组件升级支持slot内容分发功能,实现高定制内容风格的弹层 安装方法 npm install vue2-layer-mobile -S 初始化 i ...

  6. React15.6.0实现Modal弹层组件

    代码地址如下:http://www.demodashi.com/demo/12315.html 注:本文Demo环境使用的是我平时开发用的配置:这里是地址. 本文适合对象 了解React. 使用过we ...

  7. layer 1.9.2 发布,国产 Web 弹层不懈的前行者

    快速使用Romanysoft LAB的技术实现 HTML 开发Mac OS App,并销售到苹果应用商店中.   <HTML开发Mac OS App 视频教程> 土豆网同步更新:http: ...

  8. vue3系列:vue3.0自定义全局弹层V3Layer|vue3.x pc桌面端弹窗组件

    基于Vue3.0开发PC桌面端自定义对话框组件V3Layer. 前两天有分享一个vue3.0移动端弹出层组件,今天分享的是最新开发的vue3.0版pc端弹窗组件. V3Layer 一款使用vue3.0 ...

  9. Mybatis(一):手写一套持久层框架

    作者 : 潘潘 未来半年,有幸与导师们一起学习交流,趁这个机会,把所学所感记录下来. 「封面图」 自毕业以后,自己先创业后上班,浮沉了近8年,内心着实焦躁,虽一直是走科班路线,但在技术道路上却始终没静 ...

随机推荐

  1. 导出dmp

    如果有空表都需要导出执行 select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows= ...

  2. awk命令基本使用方法

    awk命令 基本用法 awk '{print $1, $4}' netstat.txt 单引号中大括号的部分就是awk语句 $1至$n表示第几列,$0表示整行 格式化输出的方法 $ awk '{pri ...

  3. win10.64位wnmp-nginx1.14.0 + PHP 5. 6.36 + MySQL 5.5.59 环境配置搭建 结合Thinkphp3.2.3

    本文20%是原创,另外参考了这里https://blog.csdn.net/foolly/article/details/78963025 作者:CSDN 古雨蓝枫 和这里https://www.cn ...

  4. log4j2 实际使用详解

    转载至: https://blog.csdn.net/vbirdbest/article/details/71751835 如下是maven项目中的实例: 首先pom.xml中引入如下依赖,注意看都是 ...

  5. oracle 11g审计关闭,及删除日志

    转自https://blog.csdn.net/louwzh/article/details/51274955 环境:Linux redhat6.3 下安装的oracle11g oracle 11g推 ...

  6. 用户层APC队列使用

    一 参考 https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-que ...

  7. Mysql优化批量插入数据

    最近为了测试项目,需要在Mysql中插入百万级测试数据,于是用到了批量插入,自己写了个简单的Spring Cloud项目. 开始时执行效率很慢,大概100条/秒,批次的大小也试过1000,2000,5 ...

  8. sqlserver2016新功能

    SQL Server 2016中的新功能(数据库引擎) 2017年1月13日  23分钟阅读时长 作者 本人建了个领优惠卷购物群,平时网购可以省点钱.有需要的加群:511169656交流,谢谢 本主题 ...

  9. WPF常用TriggerAction用法 (一)

    Microsoft.Expression.Interactivity 常用TriggerAction-> CallMethodAction ChangePropertyAction Contro ...

  10. db powerdesign CDM、LDM、PDM、OOM的区别

        导读 在本篇文章中,你将会了解到PowerDesigner工具中的三种模型CDM,OOM,PDM的区别和联系. PowerDesigner 简称PD,是一种数据建模工具,适合于开发大型应用系统 ...