textarea组件bindfocus事件获取不了键盘的高度
发布于 5 年前 作者 gang27 491 次浏览 来自 问答

textarea 组件查看文档,有如下描述

在开发者工具中,进行多个基础库版本的测试, event.detail 中无height字段。

这是官方已经确认了的问题了吗?还是我哪里有问题。

谢谢

下面是我测试的代码:

<view class="container">
  <view class="msgs">
    <view class="msg-item">12341234</view>
    <view class="msg-item">asdfasdf</view>
  </view>
  <view class="input-box">
    <textarea
      fixed="true"
      maxlength="-1"
      bindfocus="onTextareaFocus"
      adjust-position="{{ false }}"
      show-confirm-bar="{{ false }}">
    </textarea>
  </view>
</view>
Page({
  onTextareaFocus: function (e) {
    console.log(e);
  }
});

.input-box {

  positionfixed;
  bottom0;
  left0;
  right0;
  backgroundred;
}

------------------------ 更新 ------------------------

经过进一步测试,发现是模拟器的问题,真机是没有问题的,打扰了。

3 回复

真机中测试有这个字段吗?

input的height也是0,我们对齐一下吧

这是我通过开发工具打印的信息 ,可以看到 detail 里只有 value 字段

回到顶部