由于项目的扩展,新增了很多功能,今天谈一下短信验证码框的实现。

思路:每个小方框其实就是单独的每一个input标签(叫假input标签),每个长度为1,然后上面再写一个大的input标签(叫真实input标签),提高层级定位在上方,最大长度为6,然后将上方真实input标签的值传给每一个单独的假input标签。

<div class="phonenum-show">
<div class="getback-title">收回剩余礼金
<span @click="getbackMoneyclock()"><img src="../assets/getback.png" alt=""></span>
</div>
<div class="write-phonenum">
<p>请输入尾号<span></span>的手机收到的短信验证码</p>
<input type="tel" maxlength="6" class="realInput" v-model="realInput" @keyup="getNum()" @keydown="delNum()" id="focusid">
<ul class="write-input clearfix">
<li v-for="disInput in disInputs"><input type="tel" maxlength="1" v-model="disInput.value"></li>
</ul>
<mt-button size="large">我明白了 确认提交</mt-button>
<p>剩余礼金将收回至微信“零钱包”请注意查收。</p>
<p style="color:#bfc0c0;">活动结束24小时后可申请收回剩余的礼金。</p>
</div>
</div>
.phonenum-show{padding:10px;background: #fff;}
.getback-title{padding-bottom:10px;border-bottom: 1px solid #dddddd;position: relative;font-size: 14px;margin-bottom: 10px;}
.getback-title span{position: absolute;right:;top:3px;width:15px;height:15px;display: inline-block;}
.write-phonenum p{text-align: center;font-size: 12px;}
.write-phonenum p span{color: #3b90d1;}
.write-input {border:1px solid #;width:186px;margin:10px auto;}
.write-input li{float: left;width:30px;height: 30px;border-right:1px solid #ddd;}
.write-input li input{-webkit-appearance: none;-moz-appearance: none;-ms-appearance: none;resize: none;outline: none;border:;width:30px;line-height: 30px;text-align: center;height: 30px;font-size:16px;}
.write-input li:last-child{border-right: none;}
.write-phonenum .mint-button--default{background: #3b90d1;color:#fff;font-family: "微软雅黑";font-size: 14px;width:%;margin:10px auto;}
.realInput{-webkit-appearance: none;-moz-appearance: none;-ms-appearance: none;resize: none;outline: none;border:;z-index: ;position: absolute;width:186px;height: 32px;line-height: 32px;background: none;display: block;left:%;margin-left: -93px;top:76px;opacity: 0;font-size:0px;caret-color:#fff;color:#000;text-indent: -5em;}
/*影藏input标签*/
input[type="tel" i]:disabled{background-color: #fff;}
export default {
name: 'packetMessage',
data(){
return{
messagepacket:false,
packets:[ ],
disInputs:[{value:''},{value:''},{value:''},{value:''},{value:''},{value:''}],
realInput:'' }
},
methods:{
getbackMoney(){
this.messagepacket=true;
var idObj = document.getElementById('focusid');
idObj.focus();
//点击进来自动获取焦点
},
getbackMoneyclock(){
this.messagepacket=false
},
getNum(){
for(var i=0;i<this.realInput.length;i++){
this.disInputs[i].value=this.realInput.charAt(i)
// 表示字符串中某个位置的数字,即字符在字符串中的下标。
}
},
delNum(){
var oEvent = window.event;
if (oEvent.keyCode == 8) {
if(this.realInput.length>0){
this.disInputs[this.realInput.length-1].value=''
}
}
}
},
components: {}
}

vue,一路走来(14)--短信验证码框的实现(类似支付密码框)的更多相关文章

  1. SpringSceurity(5)---短信验证码登陆功能

    SpringSceurity(5)---短信验证码登陆功能 有关SpringSceurity系列之前有写文章 1.SpringSecurity(1)---认证+授权代码实现 2.SpringSecur ...

  2. 23、vue实现获取短信验证码

    1.html页面: <el-form-item prop="phoneCode" class="pr"> <el-input placehol ...

  3. atitit.短信 验证码  破解  v3 p34  识别 绕过 系统方案规划----业务相关方案 手机验证码  .doc

    atitit.短信 验证码  破解  v3 p34  识别 绕过 系统方案规划----业务相关方案 手机验证码  .doc 1. 手机短信验证码 vs 图片验证码 安全性(破解成本)确实要高一些1 1 ...

  4. 【安全测试】如何利用短信验证码BUG浪费公司的钱

    一.背景 公司新产品体验,发现不少交互.UI.功能设计上的小问题.于是花了点时间随意挑了几个功能深入的玩了一下,顺手提了BUG.接口层,看了一下接口文档,简单测了一下接口,BUG其实还挺严重的,后面详 ...

  5. Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结

    Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结 1. 验证码的前世今生11.1. 第一代验证码 图片验证码11.2. 第二代验证码  用户操作 ,比如 ...

  6. 超实用的JavaScript代码段 Item4 --发送短信验证码

    发送短信验证码 实现点击“发送验证码”按钮后,按钮依次显示为“59秒后重试”.“58秒后重试”…直至倒计时至0秒时再恢复显示为“发送验证码”.在倒计时期间按钮为禁用状态 . 第一步.获取按钮.绑定事件 ...

  7. Laravel5中使用阿里大于(鱼)发送短信验证码

    在做用户注册和个人中心的安全管理时,我实现借助第三方短信平台(阿里大于(鱼))在Laravel框架中进行手机验证的设置:阿里大于,是阿里通信旗下优质便捷的云通信服务平台,整合了三大运营商的通信能力,为 ...

  8. JS发送短信验证码

    <div> <input type="tel" id="mobile" name="mobile" placeholder ...

  9. Django商城项目笔记No.6用户部分-注册接口-短信验证码实现celery异步

    Django商城项目笔记No.4用户部分-注册接口-短信验证码实现celery异步 接上一篇,如何解决前后端请求跨域问题? 首先想一下,为什么图片验证码请求的也是后端的api.meiduo.site: ...

随机推荐

  1. jmeter性能工具 之 cookie 管理器 (二)

    上一篇主要介绍了jmeter 的基本使用方法,编写了登陆脚本,这一篇在登陆基础上,进行充值操作. 问:什么时候需要用到cookied 管理器? 答:需要登陆信息时,如果充值,提现,淘宝的下单,添加到购 ...

  2. 1N4148

    摘自http://baike.baidu.com/link?url=0iTO7zZvHpCeJiZurTPpjDT95YdJu7cKdTeCWfol36b4JG5ii15leQ7K4wJWAZIBNb ...

  3. LightOJ 1079 Just another Robbery (01背包)

    题目链接 题意:Harry Potter要去抢银行(wtf???),有n个银行,对于每个银行,抢的话,能抢到Mi单位的钱,并有pi的概率被抓到.在各个银行被抓到是独立事件.总的被抓到的概率不能超过P. ...

  4. vuex的mapState方法来获取vuex的state对象中属性

    有两种写法 1.首先在组件中引入vuex的mapState方法: 首先在组件中引入vuex的mapState方法: import { mapState } from 'vuex' 然后在compute ...

  5. vue对特殊特性的研究

    key 预期:number | string key 的特殊属性主要用在 Vue 的虚拟 DOM 算法,在新旧 nodes 对比时辨识 VNodes.如果不使用 key,Vue 会使用一种最大限度减少 ...

  6. VS2017 IDE 说明

  7. 小A与最大子段和 斜率优化 + 二分 + 细节

    Code: #include <bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) ...

  8. oracle12.2 CDB PDB基本管理操作

    容器间切换 切换到对应的PDBSSQL> alter session set container=pdb1;Session altered.SQL> alter database open ...

  9. PHP常用工具函数之手机号相关

    1.手机号正确与否判定 //测试手机号 $phone = '17777777777'; $pattern = '/^1[356789]\d{9}$/'; $is = preg_match($patte ...

  10. eclipse调试debug时出现source not found

    eclipse调试debug时出现source not found 在代码中设置了断点,程序调试过程中可以继续运行使用断点,但是看不见程序走到哪了,debug页面出现source not found, ...