input 每输入一个词都会关闭键盘再打开键盘是什么问题?
发布于 6 年前 作者 junluo 2629 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

input 每输入一个词都会关闭键盘再打开键盘是什么问题?不用数组循环,只有单独的话又没有这个问题

  • 预期表现

输入时选择词组后不会关闭键盘再打开键盘,保持打开状态。

  • 复现路径
  • 提供一个最简复现 Demo
//编辑器表单内容
    form_list: [
      { name: 'text', value: '', style: 'title', checked: 0 },
      { name: 'text', value: '内容内容内容内容内容', style: 'bold,italic', checked: 0 },
      { name: 'text', value: '引用引用引用引用引用', style: 'blockquote', checked: 0 },
 
      { name: 'image', value: 'http://yunimg.huicong365.com/2017-11-18/5a0fe97537d3d.png', checked: 0 },
    ],
/* 表单输入 */
 formListInput: function (e) {
   var that = this;
   var editor_info = that.data.editor_info;
   var form_list = that.data.form_list;
   var height = e.detail.height;
   var index = e.currentTarget.dataset.index;
   editor_info['height'] = height;
   form_list[index]['value'] = e.detail.value;
   that.setData({
     editor_info: editor_info,
     form_list: form_list
   })
 },
<view class="editor-content">
      <block wx:for="{{form_list}}" wx:key="value" wx:for-index="index">
 
        <!--文本-->
        <block wx:if="{{item.name=='text'}}">
          <block wx:if="{{!item.checked}}">
            <input class="weui-input" maxlength="-1" value="{{item.value}}" placeholder="请输入内容" bindinput="formListInput" bindfocus="formListInput" bindblur="formListInput" data-index="{{index}}" focus="{{editor_info.index==index?true:false}}" adjust-position="false" />
 
          </block>
          <block wx:else>
            <view class="text" catchtap="editorTap" data-index="{{index}}">
              {{item.value}}
            </view>
          </block>
        </block>
         
        <!--图片-->
        <block wx:elif="{{item.name=='image'}}">
          <block wx:if="{{!item.checked}}">
            <input class="weui-input" maxlength="-1" value="{{item.value}}" placeholder="请输入内容" bindinput="formListInput" bindfocus="formListInput" bindblur="formListInput" data-index="{{index}}" focus="{{editor_info.index==index?true:false}}" adjust-position="false" />
 
          </block>
          <block wx:else>
            <view class="image" catchtap="editorTap" data-index="{{index}}">
              <image src="{{item.value}}" mode="widthFix" />
            </view>
          </block>
          <!--视频-->
 
        </block>
      </block>
    </view>
回到顶部