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年,内心着实焦躁,虽一直是走科班路线,但在技术道路上却始终没静 ...
随机推荐
- HTML与CSS:结构与表现
在HTML和CSS里存在着部分重复的功能,例如两者都可以设定一段文字的字体属性.既然如此,为啥还要CSS呢(至少,为啥CSS里存在着和HTML标签属性重复的东西呢)? 这是因为,HTML和CSS的用途 ...
- 使用Excel自动生成sql语句
在近一段日子里,进入了新的项目组,由于项目需要,经常要将一些Excel表中的数据导入数据库中,以前并没有过多的接触过数据导入与数据处理,对于我来说比较痛苦,今天下午花了几个小时处理数据,但是同事给我提 ...
- node-js:文摘
ES6相关 1.module.exports与exports,export与export default之间的关系和区别 nodejs基础 1.NodeJs安装与全局配置(不建议修改包的全局安装路径, ...
- Spring4.0开始的泛型依赖
参考资料: http://www.cnblogs.com/solverpeng/p/5687304.html 视频地址:https://edu.51cto.com/course/1956.html 一 ...
- 二叉排序树插入C语言版 递归步骤理解
//二叉排序树 插入 (纯C语言实现) BTNode * BSTInsert2(BTNode *bt,int key){ //为什么纯C语言实现中 if(bt==NULL){ //要写成 bt-> ...
- 超级简单的Memcache入门
Memcache 就是一个数据库,将数据保存在内存中 常用于缓存服务器,保存操作频繁,丢失无所谓的数据 启动选项 -d 是一个守护进程 -m 内存分配 -u 用户 -l 监听地址 -p 端口 -c 最 ...
- 05-Eclispe配置Tomcat插件
此插件只针对 eclipse-java-indigo-SR2-win32 这个开发工具使用的 1.下载tomcat插件 2.解压到指定位置 3.找到eclispe安装目录 D:\software\ec ...
- English 翻译到Vyeshal的软件
我或许可以做一个从英语到Vyeshal的翻译软件2333
- 开发环境 pyenv
pyeny githup地址:https://github.com/pyenv/pyenv/ 安装时使用pyeny提供安装工具进行安装 githup 地址:https://github.com/pye ...
- Exception in thread "main" java.lang.UnsupportedClassVersionError
Exception in thread “main" java.lang.UnsupportedClassVersionError这个报错是用高版本JDK编译项目或文件产生的class文件, ...