蝙蝠岛资源网 Design By www.hbtsch.com
在ios系统,原生 webview 嵌套H5页面使用时,编写完成的6位数输入密码,输入密码卡顿问题的解决方案:
如下图:
原因是因为,CSS 这块 造成的。简单来说,style left 为负数的时候出现的,android 目测不会出现此问题
input[type=tel] {
opacity: 0;
z-index: -1;
position: absolute;
left:-100%;
}
解决方案:
重新设置 input样式问题
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>支付密码设置</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"><i v-if="msg.length > 0"></i></li>
<li :class="msg.length == 1"><i v-if="msg.length > 1"></i></li>
<li :class="msg.length == 2"><i v-if="msg.length > 2"></i></li>
<li :class="msg.length == 3"><i v-if="msg.length > 3"></i></li>
<li :class="msg.length == 4"><i v-if="msg.length > 4"></i></li>
<li :class="msg.length == 5"><i v-if="msg.length > 5"></i></li>
</ul>
<button type="button" @click="sendCode">获取验证码 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() {
//时间
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;
}
//光标
.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>
附加:如果不想使用光标,直接
//去掉 :class="msg.length == 0" 即可 <li><i v-if="msg.length > 0"></i></li>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
标签:
Vue,密码
蝙蝠岛资源网 Design By www.hbtsch.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
蝙蝠岛资源网 Design By www.hbtsch.com
暂无Vue实现6位数密码效果的评论...
更新日志
2025年10月27日
2025年10月27日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]
