欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

使用vue怎么實(shí)現(xiàn)登錄滑動(dòng)驗(yàn)證-創(chuàng)新互聯(lián)

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)使用vue怎么實(shí)現(xiàn)登錄滑動(dòng)驗(yàn)證,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

福貢ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

vue代碼

//獲取元素距離頁面邊緣的距離
getOffset(box,direction){
var setDirection = (direction == 'top') ? 'offsetTop' : 'offsetLeft' ;
var offset = box[setDirection];
var parentBox = box.offsetParent;
while(parentBox){
offset+=parentBox[setDirection];
parentBox = parentBox.offsetParent;
}
parentBox = null;
return parseInt(offset);
},
 moveCode(code,_this){
var fn = {codeVluae : code};
var box = document.querySelector("#code-box"),
progress = box.querySelector("p"),
codeInput = box.querySelector('.code-input'),
evenBox = box.querySelector("span");
//默認(rèn)事件
var boxEven = ['mousedown','mousemove','mouseup'];
//改變手機(jī)端與pc事件類型
if(typeof document.ontouchstart == 'object'){
boxEven = ['touchstart','touchmove','touchend'];
}
var goX,offsetLeft,deviation,evenWidth,endX;
function moveFn(e){
e.preventDefault();
e = (boxEven['0'] == 'touchstart') ? e.touches[0] : e || window.event;
endX = e.clientX - goX;
endX = (endX > 0) ? (endX > evenWidth) ? evenWidth : endX : 0;
if(endX > evenWidth * 0.7){
progress.innerText = '松開驗(yàn)證';
progress.style.backgroundColor = "#66CC66";
}else{
progress.innerText = '';
progress.style.backgroundColor = "#FFFF99";
}
progress.style.width = endX+deviation+'px';
evenBox.style.left = endX+'px';
}
function removeFn() {
document.removeEventListener(boxEven['2'],removeFn,false);
document.removeEventListener(boxEven['1'],moveFn,false);
if(endX > evenWidth * 0.7){
progress.innerText = '驗(yàn)證成功';
progress.style.width = evenWidth+deviation+'px';
evenBox.style.left = evenWidth+'px'
codeInput.value = fn.codeVluae;
evenBox.onmousedown = null;
_this.ruleForm.verification = true;
}else{
progress.style.width = '0px';
evenBox.style.left = '0px';
}
};
function getOffset(box,direction){
var setDirection = (direction == 'top') ? 'offsetTop' : 'offsetLeft' ;
var offset = box[setDirection];
var parentBox = box.offsetParent;
while(parentBox){
offset+=parentBox[setDirection];
parentBox = parentBox.offsetParent;
}
parentBox = null;
return parseInt(offset);
};
evenBox.addEventListener(boxEven['0'], function(e) {
e = (boxEven['0'] == 'touchstart') ? e.touches[0] : e || window.event;
goX = e.clientX,
offsetLeft = getOffset(box,'left'),
deviation = this.clientWidth,
evenWidth = box.clientWidth - deviation,
endX;
document.addEventListener(boxEven['1'],moveFn,false);
document.addEventListener(boxEven['2'],removeFn,false);
},false);
fn.setCode = function(code){
if(code)
fn.codeVluae = code;
}
fn.getCode = function(){
return fn.codeVluae;
}
fn.resetCode = function(){
evenBox.removeAttribute('style');
progress.removeAttribute('style');
codeInput.value = '';
};
return fn;
 }

調(diào)用

mounted(){
var _this = this;
// window.addEventListener('load',function(){
//code是后臺(tái)傳入的驗(yàn)證字符串
var code = "jsaidaisd656",
codeFn = new _this.moveCode(code,_this);
// });
}

驗(yàn)證樣式

.form-inline-input{
 border:1px solid #dadada;
border-radius:5px;
}
.form-inline-input input,
.code-box{
 padding: 0 3px;
width: 298px;
height: 40px;
color: #fff;
text-shadow: 1px 1px 1px black;
background: #efefef;
border: 0;
border-radius: 5px;
 outline: none;
}
.code-box{
 position: relative;
}
.code-box p,
.code-box span{
 display:block;
 position: absolute;
 left: 0;
 height: 40px;
 text-align: center;
 line-height: 40px;
 border-radius: 5px;
padding:0;
margin:0;
}
.code-box span{
 width: 40px;
 background-color:#fff;
 font-size: 16px;
 cursor: pointer;
margin-right:1px;
}
.code-box p{
 width: 0;
 background-color: #FFFF99;
 overflow: hidden;
 text-indent: -20px;
 transition: background 1s ease-in;
}
.code-box .code-input{
 display: none;
}
.code-box .code-input{
 display: none;
}
.form-inline-input{
 border:1px solid #dadada;
border-radius:5px;
}
.form-inline-input input,
.code-box{
 padding: 0 3px;
width: 298px;
height: 40px;
color: #fff;
text-shadow: 1px 1px 1px black;
background: #efefef;
border: 0;
border-radius: 5px;
 outline: none;
}
.code-box{
 position: relative;
}
.code-box p,
.code-box span{
 display:block;
 position: absolute;
 left: 0;
 height: 40px;
 text-align: center;
 line-height: 40px;
 border-radius: 5px;
padding:0;
margin:0;
}
.code-box span{
 width: 40px;
 background-color:#fff;
 font-size: 16px;
 cursor: pointer;
margin-right:1px;
}
.code-box p{
 width: 0;
 background-color: #FFFF99;
 overflow: hidden;
 text-indent: -20px;
 transition: background 1s ease-in;
}
.code-box .code-input{
 display: none;
}
.code-box .code-input{
 display: none;
}

上述就是小編為大家分享的使用vue怎么實(shí)現(xiàn)登錄滑動(dòng)驗(yàn)證了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

網(wǎng)站標(biāo)題:使用vue怎么實(shí)現(xiàn)登錄滑動(dòng)驗(yàn)證-創(chuàng)新互聯(lián)
文章來源:http://chinadenli.net/article28/dojhcp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、云服務(wù)器、App開發(fā)小程序開發(fā)、靜態(tài)網(wǎng)站標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化