1.全局添加
在uni-app的manifest.json配置文件中,可配置设置项,在里面添加以下代码
{
"app-plus":{
"softinput" : {
"mode" : "adjustPan"
}
}
}
2.局部添加
在 pages.json添加
{
"path" : "pages/home/home",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"app-plus": {
"softinputMode": "adjustResize",
"bounce": "none",
"softinput" : {
"mode" : "adjustPan"
}
},
"navigationBarTextStyle": "black"
}
},
3.还有一个是监听键盘输入弹起软键盘,隐藏tabbar
const tabbar = ref(true)
// #ifdef APP-PLUS
uni.onKeyboardHeightChange((res) => {
if(res.height>0){
tabbar.value = false
}else{
tabbar.value = true
}
//console.log(res.height);
});
// #endif