vue 在頁面在ios中input輸入彈出軟鍵盤導致定位不准


問題描述:ios移動端輸入內容,軟鍵盤彈出,頁面內容整體上移。但是鍵盤收起,頁面內容不下滑。導致定位不正確,事件無法被觸發;

解決方案:給點擊事件控制滾動條

<input class="item-input" type="text" v-model="name" placeholder="請輸入你的姓名" @blur="blurIn"/>

export default {    
  computed: {       
     scrollHeight () {           
       returndocument.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0
    }
   }   methods: {     blurIn () {       window.scrollTo(0, Math.max(this.scrollHeight - 1, 0))     }    } } 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM