this.windowHeight = document.documentElement.offsetHeight
const self = this
const u = navigator.userAgent
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
if (isIOS) {
window.addEventListener('focusin', function() {
self.text = '键盘弹出'
})
window.addEventListener('focusout', function() {
self.text = '键盘收起'
})
} else {
window.addEventListener('resize', function() {
self.thisHeight = document.documentElement.offsetHeight
if (self.windowHeight - self.thisHeight > 140) {
self.text = '键盘弹出'
} else {
self.text = '键盘收起'
}
})
}