欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

输入框固定在页面底部时,键盘挡住输入框问题(仅提供一个解决思路,不喜勿喷)

程序员文章站 2022-07-15 16:10:01
...

wxml:

<textarea placeholder='请输入您的评论' fixed="true" cursor-spacing='{{cursorSpacing}}'  show-confirm-bar='{{false}}' auto-focus='true' fixed='true' bindlinechange='bindlinechange' ></textarea>

css:

textarea{width: 100%;height: 250rpx;background:#f2f2f2;padding: 20rpx;box-sizing: border-box;font-size: 28rpx;margin-bottom: 30rpx;border-radius: 8rpx;}

js:

data中:
	cursorSpacing:'160'

bindlinechange: function (e) {
var that = this
let cursorSpacing = that.data.cursorSpacing
let height_ = e.detail.height
height_ == 0
cursorSpacing = 176.8 - height_
that.setData({
  cursorSpacing: cursorSpacing
})
console.log(e)

},