从网上搜索了好多都很麻烦,花了点事件自己做了个,简单轻便,老少皆宜
<template>
<section class="pay-mask" @click="close_mask" v-show="payshow">
<div class="container">
<div class="pay_title">请输入支付密码
</div>
<div class="flex f-d-r pay_content">
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
<div class="ipt_pay">
<input type="password" maxlength="1" disabled>
</div>
</div>
</div>
<footer>
<ul class="pay_btn">
<li @click="btnpassword($event)">1</li>
<li @click="btnpassword($event)">2</li>
<li @click="btnpassword($event)">3</li>
<li @click="btnpassword($event)">4</li>
<li @click="btnpassword($event)">5</li>
<li @click="btnpassword($event)">6</li>
<li @click="btnpassword($event)">7</li>
<li @click="btnpassword($event)">8</li>
<li @click="btnpassword($event)">9</li>
<li class="b9"></li>
<li @click="btnpassword($event)">0</li>
<li class="b9" @click="btndelete">删除</li>
</ul>
</footer>
</section>
</template>
<script>
export default {
props: {
payshow: {
type: Boolean,
default: false
}
},
data() {
return {
index: -1
}
},
created() {},
mounted() {
$(".ipt_pay input:first").focus();
},
methods: {
btnpassword(e) {
var obj = e.currentTarget;
var payinput = $(".ipt_pay input");
if (this.index < 5) {
this.index++;
$(payinput[this.index]).val($(obj).text());
}
if (this.index == 5) {
var pay_pwd = '';
var payinput = $(".ipt_pay input");
for (var i = 0; i < payinput.length; i++) {
pay_pwd += $(payinput[i]).val();
}
console.log(pay_pwd);
}
},
btndelete() {
var payinput = $(".ipt_pay input");
if (this.index >= 0) {
$(payinput[this.index]).val('');
this.index--;
}
},
close_mask() {
this.payshow = false;
}
}
}
</script>
<style scoped>
img {
width: 100%;
height: 100%;
}
section {
position: fixed;
top: 0;
width: 100%;
height: 100%;
z-index: 998;
background: rgba(0, 0, 0, .6)
}
.container {
position: absolute;
top: 4rem;
background: #fff;
border-radius: 5px;
margin: 0 .533333rem;
padding-bottom: .266667rem;
}
.pay_title {
position: relative;
font-size: .48rem;
text-align: center;
color: #333;
height: 1.333333rem;
line-height: 1.333333rem;
border-bottom: 1px solid #ddd;
}
.close {
position: absolute;
right: .2rem;
top: .2rem;
width: .72rem;
height: .72rem;
}
.pay_content {
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
border-right: 1px solid #ddd;
margin: .533333rem .533333rem .333333rem .533333rem;
}
.ipt_pay {
width: 100%;
height: 1.333333rem;
border-left: 1px solid #ddd;
}
.ipt_pay input {
border: 0;
height: 100%;
width: 100%;
text-align: center;
font-size: .88rem;
background: #fff;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
font-weight: 600;
}
.pay_btn {}
.pay_btn li {
width: 33.3333%;
float: left;
height: 1.333333rem;
line-height: 1.333333rem;
text-align: center;
background: #fff;
font-size: .48rem;
border-right: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
.pay_btn li:active {
background: #C2C2C2;
}
.b9:active {
background: #fff !important;
}
.b9 {
background: #C2C2C2 !important;
}
</style>
- Android 高仿微信支付密码输入控件
像微信支付密码控件,在app中是一个多么司空见惯的功能.最近,项目需要这个功能,于是乎就实现这个功能. 老样子,投篮需要找准角度,变成需要理清思路.对于这个"小而美"的控件,我们思 ...
- 移动端键盘密码输入框插件(jquery用于支付密码)
最后生成样子: 配置值: * back {function} 回调函数 * msghtml {html} 自定义的html * title {string|object} 标题 * {txt:标题,b ...
- 微信小程序之支付密码输入demo
在小程序中实现支付密码的输入,要解决几个问题: 1.小程序要想唤起键盘,必须要借助input控件.通过input控件和其属性focus来唤起和隐藏输入键盘. 2.要让input控件不可见.让光标和输入 ...
- js模拟输入支付密码
html <div class="content"> <!--<div class="title">支付宝支付密码:</di ...
- vue,一路走来(14)--短信验证码框的实现(类似支付密码框)
由于项目的扩展,新增了很多功能,今天谈一下短信验证码框的实现. 思路:每个小方框其实就是单独的每一个input标签(叫假input标签),每个长度为1,然后上面再写一个大的input标签(叫真实inp ...
- vue确认密码
rules: { pwd:[{ required:true, message:'创建密码',trigger:'blur' }], cpwd:[{ required:true,message:'确认密码 ...
- vue记住密码功能
话不多说,直接上代码. html部分: <el-form :model="ruleForm2" :rules="rules2" ref="rul ...
- 支付宝cookie 是支付密码 不是登录密码
开发文档/ 手机网站支付 / 产品介绍 开放平台文档中心 https://docs.open.alipay.com/203/105288
- Vue — 微信公众号内置h5支付相关
首先,在公众号后台配置h5页面地址 开发流程 1.通过配置h5地址,获取code.再通过code,获取openid getOpenid(){ let url = 'https://open.weixi ...
随机推荐
- day0203 (whil else)
count = 0while count <= 5 : count += 1 if count == 3:break print("Loop",count) else: pr ...
- lua小试牛刀
function function max(num1, num2) if(num1 > num2) then result = num1; else result = num2; end ret ...
- python(unittest)报告导出(一):使用HTMLTestRunner导出
(前提:HTMLTestRunner.py放在python安装目录的Lib文件夹下) 一般将HTMLTestRunner.py文件放入需要引用的目录下,但这个太过于局限,仅对当前项目有用,所以可以将H ...
- Python爬取LOL英雄皮肤
Python爬取LOL英雄皮肤 Python 爬虫 一 实现分析 在官网上找到英雄皮肤的真实链接,查看多个后发现前缀相同,后面对应为英雄的ID和皮肤的ID,皮肤的ID从00开始顺序递增,而英雄ID跟 ...
- java.math.BigDecimal cannot be cast to java.lang.Integer
问题来源: 在数据库中查询一个列表的长度时,需要转换为Integer类型,我刚开始直接转就报错了.因为在数据库中用count(*) 聚合函数返回的值类型为BigDecimal,不能直接转换为Integ ...
- jenkins 重置构建历史
item = Jenkins.instance.getItemByFullName("98")//THIS WILL REMOVE ALL BUILD HISTORYitem.bu ...
- datatables传参
前段时间需要修改一个项目.是拿datatables渲染的.然后需要做一个筛选.找各种文档想各种方法很麻烦.最后硬是用原生方式撸下来了. 首先他原来页面 可以看到是通过ajax方式请求了数据.那么其实筛 ...
- 通过securecrt跳板机登录linux服务器
1 需要开运维平台开通用户对某台服务器的访问权限: 2 使用自己的账号密码登录(sso账号密码) 登录后,需要输入一个服务器分配给每个人唯一的密码:
- C#只启动一个进程的代码
把写内容过程中经常用到的内容做个收藏,如下的内容是关于C#只启动一个进程的内容.public partial class App : Application { protected override ...
- pycharm 工具栏Tool中找不到Run manager.py Task
pycharm 工具栏Tool中找不到Run manager.py Task 在做Django项目的过程中, 无法进入pycharm提供的Run manager.py Task交互环境 出现这种问题是 ...