小程序弹窗中文本框textarea,唤起键盘后的BUG解决办法

论坛 期权论坛 脚本     
匿名技术用户   2020-12-28 13:56   11   0

问题:

1.手机唤起键盘后,看不到文本框

2.弹窗fixed后,textarea内容随页面滚动

解决办法:

1.给textarea 标签设置 cursor-spacing="200" 属性,表示textarea 光标距离键盘的距离。添加fixed属性

 <view class="sw-msg" bindtap="transPos">
            <textarea fixed  bindinput="msgCon" cursor-spacing="200"  placeholder="{{placehoderTxt}}" />
        </view>

2.点击文本框后设置弹窗position为absolute,关闭文本框后设置弹窗position为fixed

toggle:function () {
          this.setData({
              pos:'fixed'
          })
          this.setData({
              open:!this.data.open
          })
      },
      transPos(){
          this.setData({
              pos:'absolute'
          })
      },

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP