1、问题引入(如图)

2、修复此bug经历的过程
adjust-position设置为true或false均未解决。
- 设置
cursor-spacing后效果也不理想
- 利用
fixed定位demo看了貌似解决了。其实并没有。而且有明显卡顿(由于我这里是答题页面,涉及到很多题目,不适合)
- type类型改成
textarea基本可以解决。但是下面会介绍另外一种方法
3、解决方案
wxml文件
<scroll-view
scroll-y="{{isScroll}}"
scroll-with-animation="true"
style="height:100vh;overflow-y:auto;"
>
<view wx:if="{{currentQuestionList[idx].type == 3}}">
<van-field
value="{{ userAnswerList[(idx + (pageIndex - 1) * questionNum + 1)-1].answer }}"
placeholder="请输入答案"
border="{{ false }}"
class="inputfield"
data-index="{{(idx + (pageIndex - 1) * questionNum + 1)-1}}"
bind:input="inputChange"
bindfocus="onFocus"
bindblur="onBlur"
/>
</view>
</scroll-view>
js文件
Page({
data: {
isScroll: true
},
onFocus(e) {
this.setData({
isScroll: false
})
},
onBlur(e) {
this.setData({
isScroll: true
})
},
})