问题:增加textarea行,view层和整个textarea位置会上移,麻烦指点解决下增加行不上移,谢谢!
wxml:
<view wx:if="{{canCom}}" class="textbase" style="bottom:{{keyheight}}rpx;position:fixed;">
<view class="sebase">
<textarea fixed="{{false}}" hold-keyboard="true" bindfocus="focuskeyHeight" bindblur="lostkeyHeight" disable-default-padding="{{false}}" placeholder="这个只有在按钮点击的时候才聚焦" focus="{{focus}}" show-confirm-bar="{{false}}" class="textcss" />
</view>
</view>
<view>{{keyheight}}</view>
<view>
<button bindtap="doComment" type="default">评论</button>
</view>
wxss:
.textbase{
width: 100%;height: 300rpx;border: 1rpx solid #e8e8e8;background-color: antiquewhite;
}
.sebase{
width: 100%;height: 100%;position: fixed;overflow: unset;
}
.textcss{
background-color: teal;width: 100%;height: 250rpx;position: fixed;
}
js:
data: {
canCom: false, //评价开关
focus: false,
keyheight: 0, //键盘高度
positions: "absolute"
},
doComment: function(){
this.setData(
{
canCom: true,
focus: true,
positions: "fixed"
}
)
},
focuskeyHeight: function(res){
this.setData(
{
keyheight:res.detail.height,
positions: "fixed"
}
)
},
lostkeyHeight: function(res){
this.setData(
{
keyheight:0,
positions: "absolute"
}
)
},
addline: function(){
this.setData(
{
keyheight: 0,
}
)
},
改为true