ios上多个输入框点击切换后移位导致的问题
// bug1mounted() {document.body.addEventListener('focusout', this.resetScroll)},destory() {document.body.removeEventListener('focusout', this.resetScroll)}// 处理ios上点击输入框后移位导致的问题resetScroll() {if (this.isIos()) {setTimeout(() => {// 当焦点在弹出层的输入框之间切换时先不归位window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })}, 300)}},isIos() {var u = navigator.userAgentvar isIos = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) // ios终端return isIos}////// bug2// fix: 修复ios中输入框未失去焦点键盘弹出时,点击开户地导致按钮错位的问题setTimeout(function() {var scrollHeight =document.documentElement.scrollTop || document.body.scrollTop || 0window.scrollTo(0, Math.max(scrollHeight - 1, 0))}, 100)
解决ios回退不刷新问题
if (isIos()) {window.onpageshow = function(event) {if (event.persisted) {window.location.reload();}};}
