2***@qq.com
2***@qq.com
  • 发布:2025-05-25 21:58
  • 更新:2025-05-30 12:14
  • 阅读:72

uniapp 小程序 文本域禁止失去焦点怎么做 ,怎么做才能点击发送 禁止失去焦点 进而键盘不回收

分类:uni-app
<textarea  :focus="focusHow" v-model="textContnt" :cursorSpacing="20" :show-confirm-bar="false" :auto-height="true"  
                @confirm.prevent="Finalsends" name="" id="" :adjust-position="false" placeholder="说点什么..." style="     
                        min-height: 110rpx !important;  
                        background-color: #f4f4f6;  
                        border-radius: 13px;  
                        width: 89vw;  
                        margin-left: 26rpx;  
                        margin-top: 16rpx;  
                        padding: 6px 10px;  
                        caret-color: #4e86e5;  
                        ">  
            </textarea>  
            <view class="emojiStyle">  
                <view class="emojiStyle-1">  
                    <view class="" style="flex: 1;display: flex;justify-content: space-around;">  
                            <uni-icons custom-prefix="iconfont" style="    margin-top: 6rpx;"  type="icon-aite" color="#666"  
                                size="21"></uni-icons>   
                            <uni-icons custom-prefix="iconfont" style="    margin-top: 6rpx;"  type="icon-xiaolian" color="#666"   
                                size="21"></uni-icons>   
                            <uni-icons type="image" size="26" color="#666" />  
                            <uni-icons type="plus" size="26" color="#666" />  
                    </view>  
                    <view class="" style="flex: 1;display: flex;justify-content: flex-end;">  
                        <view class="send" :class="{activesebd:textContntActive}">  
                            发送  
                        </view>  
                    </view>  
                </view>
2025-05-25 21:58 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

这样强制禁止失去焦点的行为,是非常影响用户体验的行为,没有直接可以使用的 API,但是你如果想强制这么做,你可以试一下:

  • 监听失去焦点之后立刻重新聚焦
  • 给textarea周围包裹一个遮罩层,限制用户点击
  • 2***@qq.com (作者)

    不会影响用户体验啊 比如 我输入完文字想添加表情 点击表情这个时候键盘会收回 抖音就不是这样的

    2025-05-30 12:10

2***@qq.com

2***@qq.com (作者)

我点击下面的表情 键盘会收回 我想要禁止键盘回收 怎么做呢?

  • DCloud_UNI_yuhe

    这点击表情又不是点击文本域吧

    2025-06-04 11:17

  • 2***@qq.com (作者)

    回复 DCloud_UNI_yuhe: 对啊 表情是一个 标签 没在文本域里面 点击表情 文本域键盘会回收 怎么解决呢

    2025-06-04 14:51

要回复问题请先登录注册