在ios系統(tǒng),原生 webview 嵌套H5頁(yè)面使用時(shí),編寫完成的6位數(shù)輸入密碼,輸入密碼卡頓問(wèn)題的解決方案:
成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),大慶企業(yè)網(wǎng)站建設(shè),大慶品牌網(wǎng)站建設(shè),網(wǎng)站定制,大慶網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,大慶網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
如下圖:

原因是因?yàn)椋珻SS 這塊 造成的。簡(jiǎn)單來(lái)說(shuō),style left 為負(fù)數(shù)的時(shí)候出現(xiàn)的,android 目測(cè)不會(huì)出現(xiàn)此問(wèn)題
input[type=tel] {
opacity: 0;
z-index: -1;
position: absolute;
left:-100%;
}解決方案:
重新設(shè)置 input樣式問(wèn)題
input[type=tel] {
width: 0.1px;
height: 0.1px;
color: transparent;
position: relative;
top: 23px;
background: #000000;
left: 46px;
border: none;
font-size: 18px;
opacity: 0;
z-index: -1;
}全部代碼在這,你可以拿出去使用即可
<template>
<div id="payPwd">
<header>支付密碼設(shè)置</header>
<input ref="pwd" type="tel" maxlength="6" v-model="msg" class="pwd" unselectable="on" />
<ul class="pwd-wrap" @click="focus">
<li :class="msg.length == 0?'psd-blink':''"><i v-if="msg.length > 0"></i></li>
<li :class="msg.length == 1?'psd-blink':''"><i v-if="msg.length > 1"></i></li>
<li :class="msg.length == 2?'psd-blink':''"><i v-if="msg.length > 2"></i></li>
<li :class="msg.length == 3?'psd-blink':''"><i v-if="msg.length > 3"></i></li>
<li :class="msg.length == 4?'psd-blink':''"><i v-if="msg.length > 4"></i></li>
<li :class="msg.length == 5?'psd-blink':''"><i v-if="msg.length > 5"></i></li>
</ul>
<button type="button" @click="sendCode">獲取驗(yàn)證碼 lodding</button>
</div>
</template>
<script>
import api from "./api";
import "@/js/utils"; //公共方法
export default {
components: {},
data() {
return {
msg: '',
}
},
created() {},
computed: {},
watch: {
msg(curVal) {
if(/[^\d]/g.test(curVal)) {
this.msg = this.msg.replace(/[^\d]/g, '');
}
},
},
methods: {
focus() {
this.$refs.pwd.focus();
},
sendCode() {
//時(shí)間
utils.sendCode(event.target);
//showLoading
utils.view.showLoading();
setTimeout(function() {
utils.view.dismissLoading();
}, 5000);
}
},
mounted() {}
}
</script>
<style lang="less" scoped>
#payPwd {
height: auto;
header {
text-align: center;
height: 80px;
line-height: 90px;
text-align: center;
}
input[type=tel] {
width: 0.1px;
height: 0.1px;
color: transparent;
position: relative;
top: 23px;
background: #000000;
left: 46px;
border: none;
font-size: 18px;
opacity: 0;
z-index: -1;
}
//光標(biāo)
.psd-blink {
display: inline-block;
background: url("./img/blink.gif") no-repeat center;
}
.pwd-wrap {
width: 90%;
height: 50px;
padding-bottom: 1px;
margin: 0 auto;
background: #fff;
border: 1px solid #ddd;
display: flex;
display: -webkit-box;
display: -webkit-flex;
cursor: pointer;
position: absolute;
left: 0;
right: 0;
top: 13%;
z-index: 10;
li {
list-style-type: none;
text-align: center;
line-height: 50px;
-webkit-box-flex: 1;
flex: 1;
-webkit-flex: 1;
border-right: 1px solid #ddd;
&:last-child {
border-right: 0;
}
i {
height: 10px;
width: 10px;
border-radius: 50%;
background: #000;
display: inline-block;
}
}
}
button {
position: relative;
display: block;
height: 41px;
text-align: center;
margin: 0 auto;
margin-top: 70%;
padding: 0 20px;
border-radius: 5px;
font-size: 16px;
border: 1px solid #dddddd;
background: #dddddd;
color: #000000;
}
}
</style>附加:如果不想使用光標(biāo),直接
//去掉 :class="msg.length == 0?'psd-blink':''" 即可 <li><i v-if="msg.length > 0"></i></li>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。
文章標(biāo)題:Vue實(shí)現(xiàn)6位數(shù)密碼效果
本文URL:http://www.chinadenli.net/article22/jdhejc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、網(wǎng)站建設(shè)、、網(wǎng)站排名、品牌網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)
聲明:本網(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í)需注明來(lái)源: 創(chuàng)新互聯(lián)