收藏
回答

请高手帮忙解决textarea框上移的问题?

问题:增加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,

        

      }

    )

  },


回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签