uniapp 输入法画面_uniapp点击输入框时键盘不上推页面

试了好几种方法,最后只能adjust-position设置为false,然后监听键盘的高度赋值给输入框bottom

这里还一个非常重要的地方,在根元素设置@touchmove.stop.prevent,这样在ios上页面就不会滚动,不影响其他组件内部滚动

onReady() {

// 监听键盘高度变化,以便设置输入框的高度

uni.onKeyboardHeightChange(res => {

this.inputOffsetBottom = res.height

if (res.height === 0) {

this.focus = false

}

})

},

v-model="commentValue"

:style="{bottom: inputOffsetBottom > 0 ? inputOffsetBottom + 'px' : '0'}"

:disabled="setDisabled"

:adjust-position="false"

:cursor-spacing="20"

:placeholder="placeholderText"

type="text"

class="lp-comment-input"

confirm-type="send"

@focus="onInputFocus"

@blur="onInputBlur"

@confirm="onInputEnter"

@keyboardheightchange="onKeyBoardHeightChange"

/>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值