<Field v-model="name" clearable @focus="inputFocus"/>
mounted () {
this.ioskeyBoardFix()
},
ioskeyBoardFix () { // ios系统键盘收起时的页面对齐
let _this = this
document.body.addEventListener('focusout', () => {
let u = window.navigator.userAgent
let isIos = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
if (!isIos) {
return false
}
_this.scrollTimer = setTimeout(() => {
window.scrollTo({
top: 0,
behavior: 'smooth'
})
}, 300)
})
},
inputFocus () {
if (this.scrollTimer) {
clearTimeout(this.scrollTimer)
this.scrollTimer = null
}
},
网友评论