ios-键盘弹起导致顶部的header-定位失效

27次阅读

共计 362 个字符,预计需要花费 1 分钟才能阅读完成。

  1. ios 手机 键盘弹起时候 header 的固定定位就悬浮了

===>. 解决: 我的做法是直接监听 ios 键盘弹起事件,弹起的时候就隐藏 header,键盘收起在显示

<van-nav-bar title="创建赛事"  v-if="isShowNavBar" />


    document.body.addEventListener('focusin', () => {// 软键盘弹起事件 console.log("键盘弹起")
      console.log('键盘弹起了');
      this.isShowNavBar = false
    })

    document.body.addEventListener('focusout', () => {// 软键盘关闭事件 console.log("键盘收起")
      console.log('键盘收起了');
      this.isShowNavBar = true
    })

正文完
 0