如果input 中没有设置这个属性,你的内容将被上推上去。注意设置这个是false要加{{}}括起来,不然也不起作用。
<input class="commentinput" adjust-position='{{false}}' bindinput='sendtext' value="{{textname}}" placeholder="跟主播聊点什么" cursor-spacing='20' bindfocus="bindfocus" bindblur="bindblur"></input>
这个还需要做一个适配,把输入框上移,焦点消失下移。
bindfocus: function (e) {
console.log(e)
let that = this;
let height = 0;
let height_02 = 0;
wx.getSystemInfo({
success: function (res) {
console.log(res)
height_02 = res.windowHeight;
}
})
console.log(e.detail.height);
// height = e.detail.height - (app.globalData.height01 - height_02);
height = app.globalData.height01;
console.log('app is', app.globalData.height01);
that.setData({
height: height,
})
console.log(height);
console.log(height_02);
},
bindblur: function (e) {
this.setData({
height: 20,
});
},