安卓平台处理
//安卓机在键盘弹出后防止按钮顶上来
mounted() {
this.windowHclass=window.innerHeight<=480?"min": window.innerHeight<667?"active":(window.innerHeight>700?"actives":"");
this.clientHeight=document.body.offsetHeight;
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
window.addEventListener("resize", this.handleResize);
this.Android =true
}
}
handleResize(){
let nowHeight = document.body.offsetHeight;
this.btnShow = nowHeight === this.clientHeight;//控制显示和隐藏按钮
document.getElementById('home').style.height= (this.clientHeight-40)+'px'
}
ios平台处理
//ios在获取焦点后下面的空白隐藏
blurfn() {
let u = navigator.userAgent;
if(u.indexOf('iPhone') > -1){
window.scrollTo(0, this.clientHeight);
}
},
focus() {
let u = navigator.userAgent;
if(u.indexOf('iPhone') > -1){
window.scrollTo(0, 100);
};
},
网友评论