1***@qq.com
1***@qq.com
  • 发布:2020-11-26 14:08
  • 更新:2021-06-24 16:40
  • 阅读:928

textarea组件超出最大值

分类:uni-app

textarea组件

输出为小程序

设置了最大长度为50,安卓端输入时仍然会超出50个字,超出范围在10个字以内。但是textarea显示区域内为50个字,前端抓取的实际字符串长度和后端接收的都是超过50个字一点的。

ios端不会超出,但是达到字符串限制长度后,调整光标至文本开头或中间。输入任意长度的连续英文字母,该字母串会直接替换输入框内容末尾对应长度的原字符。这正常吗?

2020-11-26 14:08 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者) - 90后

<view class="group">  
      <view class="item">  
        <view class="label">访问事由</view>  
        <view class="nums"  
          ><text>{{ query.reason.length }}/</text>50</view  
        >  
      </view>  
      <view class="item">  
        <view class="info">  
          <textarea  
            auto-height  
            maxlength="50"  
            v-model="query.reason"  
            placeholder="请输入"  
            placeholder-style="color: #cacaca"  
          ></textarea>  
        </view>  
      </view>  
    </view>
禅道在逃bug

禅道在逃bug

    auto-height    
    maxlength="50"    
    v-model="query.reason"    
    placeholder="请输入"    
    placeholder-style="color: #cacaca"    
    @input="bindTextAreaBlur"  
></textarea>```                                                                                                                                                                
 ```javascript  
 bindTextAreaBlur2: function (e) {  
    let maxValue = e.detail.value  
    if(maxValue.length>=50){  
    this.$nextTick(()=>{  
         this.query.reason=e.detail.value.substring(0,50)  
        })  
    }  
   }

该问题目前已经被锁定, 无法添加新回复