uni-app如何解决软键盘顶起底部fixed定位元素。
<input type="text" @click="hideTabbar" @focus="hideTabbar" @blur="showTabbar" placeholder=""/>
<view v-if="tabbar">底部悬浮</view>
data(){
return{
tabbar: true,
windowHeight: ''
}
},
onLoad() {
uni.getSystemInfo({
success: (res)=> {
this.windowHeight = res.windowHeight;
}
});
uni.onWindowResize((res) => {
if(res.size.windowHeight < this.windowHeight){
this.tabbar = false
}else{
this.tabbar = true
}
})
},
methosd:{
showTabbar(){
this.tabbar = true;
},
hideTabbar(){
this.tabbar = false;
}
}
@click和@blur 分别解决安卓和ios 兼容问题