解决uni-app弹出键盘导致页面的底部被挤压,导致变形
官方的aip用了,但是好像没有效果(不知道是不是我的问题,可能是我的页面底部是组件的原因)索性就另辟蹊径,我的思路是监听屏幕高度来控制data(){return{// 获取频幕高度documentHeight: document.documentElement.clientHeight,}}mounted(){window.onresize = () => {return (() =>
·
官方的aip用了,但是好像没有效果(不知道是不是我的问题,可能是我的页面底部是组件的原因)
索性就另辟蹊径,
我的思路是监听屏幕高度来控制
data(){
return{
// 获取频幕高度
documentHeight: document.documentElement.clientHeight,
}
}
mounted(){
window.onresize = () => {
return (() => {
if (this.documentHeight > document.documentElement.clientHeight) {
//键盘升起时
this.show = false
} else {
//键盘关闭时
this.show = true
}
})();
};
}
更多推荐
已为社区贡献4条内容
所有评论(0)