zoukankan      html  css  js  c++  java
  • 关于页面input导致页面可滑动问题(iOS上)

    关于页面input导致页面可滑动问题(iOS上)

    安卓关于弹出键盘问题可以用resize解决
    解决方案:滑动页面的时候让对应的input失去焦点(默认滚动不失去焦点)

    1.给input组件添加获取焦点事件,并传人对应input的参数

    @onFocus="onFocus(0)"  //input绑定获取焦点事件
    

    2.追加事件

    onFocus(val){  //获取焦点事件
    this.isScroll=true
       setTimeout(()=>{
                if(this.isScroll){
                  this.inputName=val
                  window.addEventListener('scroll', this.scrollEvent);
                }
              },800)
     }, 
      scrollEvent(){  //滚动事件
       var input1 =document.getElementsByClassName('inputState')[this.inputName]
       input1.blur()
       window.removeEventListener('scroll', this.scrollEvent);
     },
     getBlure(){  //失去焦点事件(过快失去焦点的时候不去绑定事件)
              this.isScroll=false
          },
    

    如果页面有多个input,需要在input失去焦点或者其判断事件触发后移除滚动事件

    3.销毁

       destroyed() {    //清除scroll事件
          window.removeEventListener('scroll', this.scrollEvent);
        },
    
  • 相关阅读:
    API之绘图函数
    DotNetCharting
    Rule engine
    股票
    PHP
    获取Excel.dll
    Excel develop
    几个不错的开源的.net界面控件[转贴]
    关于EXCEL文件双击打不开的问题
    Regular expression
  • 原文地址:https://www.cnblogs.com/liuhuanwen/p/8818767.html
Copyright © 2011-2022 走看看