textarea焦点问题
发布于 5 年前 作者 nxie 12580 次浏览 来自 问答

在安卓机上textarea设置了wx:if="true"时候自动聚焦并且拉起键盘,开始都正常,但是多点击几次就不能获取焦点,也不能拉起键盘,甚至点击textarea都没任何反应,里面原有的内容会随着页面滚动儿滚动,ios是正常的

2 回复

你好,麻烦具体描述问题流程,提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

<view wx:if="{{keyShows}}" class='warpper-textCon' style="bottom:{{keyHeights-2}}px">
    <textarea class='textCon' show-confirm-bar='{{false}}' value='{{value}}' auto-focus="{{true}}" bindinput='messageInput' bindblur='noShow' bindfocus='bindfocusHeigth' adjust-position='{{false}}' focus='{{true}}'></textarea>
    <form bindsubmit="submit" report-submit='true' data-submit='{{!isregister}}'>
      <button data-type='2' class='clear' open-type="{{unionname?'':'getUserInfo'}}" bindgetuserinfo='bindgetuserinfo' form-type="submit">
        <view class='textOk'>发表评论</view>
      </button>
    </form>
  </view>
  <view class='messInput' id='position' wx:if="{{IsDiscuss==1}}">
    <image src='{{head}}' mode='aspectFill' wx:if='{{head}}'></image>
    <image src='/dist/cardimgs/photosy.png' mode='aspectFill' wx:else></image>
    <view type='text' catchtap='tirgger'>简单说说...</view>
  </view>
js部分
tirgger(){
    this.setData({
      keyShows: true,
    })
    console.log('是实打实的')
  },
//获取键盘高度
  bindfocusHeigth(e){
    this.setData({
      keyHeights: Number(e.detail.height)
    });
    console.log(e.detail.height)
  },
noShow(){
    this.setData({
      keyShows: false,
      value: this.data.messageInput
    })
    console.log(this.data.keyShows)
  },
//输入框事件
  messageInput: function(e) {
    if (e.detail.value == '') {
      this.setData({
        disabled: true
      })
    } else {
      this.setData({
        disabled: false
      })
    }
    this.setData({
      messageInput: e.detail.value
    })
  },

安卓机的问题  ios没问题

回到顶部