- 需求:登录页面,全屏底背景,有表单输入框
- 问题:键盘弹起后,底背景上推,表单输入框跟着上推
解决:
表单上推解决方案:
page.json 配置
{
"path" : "pages/login/login", //聊天页
"style" : {
"app-plus": { // 在pages.json文件里面中配置
"softinputMode": "adjustPan"
}
}
}
form表单:
:adjust-position="false"
底背景解决方案:
page页面不要高度100%, 底背景元素也不要100%
动态获取屏幕高度,赋值给背景元素
背景元素相对定位或者固定定位都可以,最终背景元素不会上推也不会被挤压
<view class="bg" :style="{height: screenHeight == 0 ? '100%':screenHeight+'px'}"></view>
created() {
this.screenHeight = uni.getSystemInfoSync().windowHeight;
},
版权声明:本文为weixin_43109722原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。