ios 弹框focus事件聚焦不弹出键盘

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;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值