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

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. 把一个对象转成map对象

    import java.lang.reflect.Field;import java.util.HashMap; public class Util { public static HashMap&l ...

  2. 【C++】const & 指针

    https://blog.csdn.net/qq_21808961/article/details/78401950

  3. SVN迁移到GitLab,保留提交记录

    1.下载GitBash 此工具自带git svn命令,无需再下载git-svn工具 2.GitBash终端中输入以下命令 git svn clone svnurl srcPath 3.push本地仓库 ...

  4. App_Code目录类文件无法被调用的解决方法

    1.选中类文件,在属性中的“生成操作”默认的“内容”改为“编译”就可以了. 2.重新生成解决方案

  5. Linux期中架构

    1    在构建完模板后  开启虚拟机后 需要再重启一次  以解决网卡不能看见的问题 ########################################add begin 2018-05 ...

  6. python模拟大数据登陆

    #针对tableu 撰写的大数据框架 #tesseract 识别简单的验证码 不多说  直接上代码 # coding:utf-8 from selenium import webdriver from ...

  7. 二、初步认识springBoot的pom.xml

    1.  大体结构 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www. ...

  8. 解决logging模块日志信息重复问题

    解决logging模块日志信息重复问题 问题描述 相信大家都知道python的logging模块记录日志信息的步骤: # coding:utf-8 import logging ### 创建logge ...

  9. 傻瓜学编程之block_1

    1.引出 1.1.int pp = 3;for循环为dd赋值并 调用 finprint(int ,int)函数 获取pp*dd的乘积,输出 void finalValue(int d, int sca ...

  10. css常见布局问题

    1.如何实现一个盒子在页面中上下左右居中 方法一:(盒子宽高固定时) .box{ width:400px; height:200px; background:#000; position:absolu ...