ios调用input的focus事件,input无反应无键盘弹出,需要用户手动点击才能触发。
解决方法
在ios中调用不能使用v-if或者v-show事件,css不能display:none; 要保证input一直处于页面中,可以使用z-index调整层级,opacity:0;改变div的透明度来进行,也可以使用定位方法将input定位到用户不可见的位置,触发弹框再将input定位回来显示
- html
<div class="text-center dialog password-panel">
<div class="title">
<div class="close"></div>
<div class="fingerprint">开通指纹支付</div>
</div>
<div class="input-wrap">
<div class="input">
<input type="password" placeholder="请输入支付密码" class="password" />
<div class="input-close"></div>
</div>
<div class="text-left error"></div>
</div>
<div style="height: .82rem;">
<a href="#" class="forget pull-right">忘记支付密码?</a>
</div>
<div class="footer"></div>
</div>
- css
- 通过改变父级的css*** opacity: 0; z-index: -1;***来进行弹框的显示隐藏
.password-panel {
width: 6rem;
height: 3.86rem;
padding: 0.6rem 0.3rem .4rem;
display: block;
opacity: 0;
z-index: -1;
right: 0;
top: 0;
bottom: 0;
margin: 1.5rem 0;
}
.title {
position: relative;
font-weight: 700;
margin-bottom: 0.6rem;
}
.close {
top: 0rem;
left: 0;
width: 0.24rem;
height: 0.24rem;
position: absolute;
background: url(../images/close.png) no-repeat;
background-size: 0.24rem 0.24rem;
}
.fingerprint {
position: absolute;
top: 0.03rem;
right: 0;
color: #4076ff;
}
.input-wrap {
height: 1.3rem;
}
.input {
height: 0.9rem;
display: flex;
}
.password {
flex: 1;
border-style: none;
border-bottom: 1px solid #f0f0f0;
font-size: 0.26rem;
padding-left: 0.1rem;
line-height: normal;
font-family: PingFangSC, sans-serif;
background-color: #fff;
}
.input-close {
width: 0.3rem;
height: 0.3rem;
display: none;
margin: 0.3rem .08rem 0 0;
background: url(../images/close2.png) no-repeat;
background-size: 0.3rem 0.3rem;
}
.error {
color: #f00;
margin-top: .1rem;
}
.forget {
text-align: right;
color: #4076ff;
display: block;
}
.footer {
color: #fff;
height: 0.9rem;
font-size: 0.32rem;
line-height: 0.9rem;
border-radius: 0.09rem;
background-color: #4076ff;
}