开发微信小程序,解决键盘弹起时,输入框提示文字被推上去的问题(uniapp + vue3 + uview plus)
·
更改前代码如下:
<template>
<view class="pageContent">
<slot></slot>
<u-safe-bottom v-if="!props.formHome"></u-safe-bottom>
<FloatBtn v-if="!props.formHome && !dontShowFloatBtn"></FloatBtn>
</view>
</template>
<style lang="scss" scoped>
.pageContent {
background: #ffff;
font-family: PingFangSC, PingFangSC-Regular;
display: flex;
flex-direction: column;
height: 100vh;
}
</style>
更改后代码如下:
<template>
<scroll-view scroll-y enable-flex class="pageContent">
<slot></slot>
<u-safe-bottom v-if="!props.formHome"></u-safe-bottom>
<FloatBtn v-if="!props.formHome && !dontShowFloatBtn"></FloatBtn>
</scroll-view>
</template>
<style lang="scss" scoped>
.pageContent {
background: #ffff;
font-family: PingFangSC, PingFangSC-Regular;
display: flex;
flex-direction: column;
height: 100vh;
overflow-y:scroll;
overflow-x:hidden;
}
</style>
主要就是将view改为scroll-view,这样不仅能解决解决提示文字被推上去的问题,弹起的键盘也能正常把页面推上去
更多推荐
所有评论(0)