Solve problems (iOS end) after the micro-channel H5 page soft keyboard pops up a blank page below

Preface : micro-channel H5 project, ios end appeared after the soft keyboard losers hide page does not rebound, there will be a large piece of blank space below

Recently micro-channel version and have ios upgrade, I do not know which side caused by the upgrade, but after the test, the soft keyboard away, and then scroll a page at the following blank will disappear. So as long as simulate what the "rolling" operation after input is completed, will be able to solve the problem.

If you are using vue wrote:

<input type="text" @blur="fixScroll" placeholder="请输入xxx"/>
 
//methods中添加:
 
fixScroll() {
 
    window.scrollTo(0, 0);
 
}

Because this problem only occurs iOS end it prior to use judgment about:

fixScroll() {
        let u = navigator.userAgent;
        let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if (isiOS) {
          window.scrollTo(0, 0);
        }
      }

Done

Guess you like

Origin www.cnblogs.com/zouwangblog/p/11139779.html