Click on the input box to solve ios environment jack-up page is not automatically rebound in the end section issues

The first step: add the input box gets the focus event code label wording: @ focus = "getFocus" (vue Code) can be copied directly take on his page elements, as follows:

 <div class="o-field o-grid__cell carinfo-grid__cell">
            <input
              @blur="onPlaceholderMobleBlur"
         @focus="getFocus" : value = "holderMobile" class = "c-Field," of the type = "text" placeholder = "Please enter the phone number policyholders" maxlength = "11"> </div>

Second step: to obtain a focus event declaration in the following writing process methods, the following code can directly copy

 methods: {
    getFocus() {
      $("input,textarea").on("blur", function() {
        window.scroll(0, 0);
      });
    },

Here the introduction of jQuery (jQuery or a good use)

The principle:
      the principle is the keyboard pops up when, window.scrollY will change from 0 to the height of the keyboard (for example: 200), when the input box lose focus back to let scrollY like 0

Or write so just do not need the introduction of jQuery

1  window.addEventListener('focusout', function () {
2       document.body.scrollTop = document.body.scrollHeight;
3  })

 

<div class="o-field o-grid__cell carinfo-grid__cell">
<input
@blur="onPlaceholderMobleBlur"
:value="holderMobile"
class="c-field"
type="text"
placeholder="请输入投保人手机号"
maxlength="11">
</div>

Guess you like

Origin www.cnblogs.com/yangwenbo/p/11028005.html