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

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. DEX: Deep EXpectation of apparent age from a single image 论文阅读

    来自:IMDB-WIKI - 500k+ face images with age and gender labels  https://data.vision.ee.ethz.ch/cvl/rrot ...

  2. 【环境部署】centos7安装mysql-5.7.19 group-replication

    --mysql高可用官方文档: https://dev.mysql.com/doc/refman/5.7/en/group-replication.html mysql下载地址: https://ww ...

  3. jmeter 之beanshell preprocessor

    Bean Shell PreProcessor 可参考https://blog.csdn.net/shimengran107/article/details/76849748 是一个前置处理器,它可以 ...

  4. 廖雪峰Java8JUnit单元测试-1JUnit简介-1JUnit测试

    测试驱动开发(Test Driver Development) 1.使用main()方法测试的缺点: 只能有1个main()方法,不能把测试代码分离 没有打印出测试结果和期望结果,例如expected ...

  5. Ubuntu16.04 apt源更新

    更新源 安装好系统后,先更新源,方便后面能比较快地下载各种软件包. 备份/etc/apt/sources.list,然后将内容全部替代为: # deb cdrom:[Ubuntu 16.04 LTS ...

  6. LDAP & Implentation

    LDAP: LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根据需 ...

  7. 关于mysql文件导入提示“Variable @OLD_CHARACTER_SET_CLIENT can't be set to the value of @@CHARACTER_SET_CLIENT”问题分析

    今天用myssqldump导出数据,然后再导入另外mysql数据库时,提示Variable @OLD_CHARACTER_SET_CLIENT can't be set to the value of ...

  8. 游戏AI

    玩游戏太累了,我或许可以写一个机器人帮我玩游戏发QQ发空间啥的

  9. Gradle史上最详细解析

    转自:https://www.cnblogs.com/wxishang1991/p/5532006.html 郑重申明本文转自邓凡平老师的 http://www.infoq.com/cn/articl ...

  10. Linux下Docker快速部署LAMP

    文章目录 拿来即用 获取LAMP LAMP版本 icoty1/lamp:v1.1.0制作过程 获取ubuntu基础镜像 安装依赖 mysql apache/php phpmyadmin 使apache ...