1、
<van-field
@focus="focusTextarea"
/>
2、在最外层的盒子 css :style="{paddingBottom: inputBottom + 'px'}"
3、在输入框的盒子上写
<van-cell-group :style="{bottom: inputBottom+'px'}">
<van-field
@focus="focusTextarea"
/>
</van-cell-group>
4、data(){
return{
inputBottom:0
}
}
5、
focusTextarea(e) {
this.inputBottom = e.target.height/2;
},
e.target.height先打印e,看一下你的键盘高度具体是什么,有可能是e.detail.height,
this.inputBottom的值可以根据自己的需求来设置