textarea在uni-app设置auto-height后再设置max-height 输入内容超过高度后换行第一次光标不会更随当值对于内容需要手动滑动

textarea在uni-app设置auto-height后再设置max-height 输入内容超过高度后换行第一次光标不会更随当值对于内容需要手动滑动

操作步骤:

  • 随便一个textarea 只要设置了 max-height 就会出现

预期结果:

  • 当换行时自动向上滚动,显示最后一行的问题

实际结果:

  • 换行后,需要手动滚动,或者继续输入文字才会显示最新一排文字

bug描述:

  • 【报Bug】textarea设置auto-height后再设置max-height 输入内容超过高度后换行第一次光标不会更随,当值对于内容需要手动滑动
信息类别 信息内容
产品分类 uniapp/App
PC开发环境 Windows
PC系统版本 win11
HBuilderX 正式
HBuilderX版本 4.81
手机系统 Android
手机系统版本 Android 16
手机厂商 OPPO
手机机型 oppo
页面类型 vue
vue版本 vue3
打包方式 云端
项目创建方式 HBuilderX

Image Image Image


更多关于textarea在uni-app设置auto-height后再设置max-height 输入内容超过高度后换行第一次光标不会更随当值对于内容需要手动滑动的实战教程也可以访问 https://www.itying.com/category-93-b0.html

6 回复

提供完整复现代码。对比下 app 和 web 是否有差异

更多关于textarea在uni-app设置auto-height后再设置max-height 输入内容超过高度后换行第一次光标不会更随当值对于内容需要手动滑动的实战教程也可以访问 https://www.itying.com/category-93-b0.html


<template> <textarea class="multi-line-input" v-model="text" cursor-spacing="20" :adjust-position="false" id="msg-input" auto-height confirm-type="send" :confirm-hold="true" :show-confirm-bar="false" maxlength="1500"></textarea> </template>
<script setup lang="ts"> import { ref } from "vue";

const text = ref(’’) </script>

<style lang="scss" scoped> .multi-line-input { width: 100%; background-color: yellow; max-height: 200px; overflow-y: auto; resize: none; } </style> 就是一个普通的textarea 设置了max-height 就会出现这个问题,app和web都有同样的问题

回复 3***@qq.com: 使用 web 和安卓 13 输入大量文字,观察光标位置始终在最后一行,向上滚动文字之后继续输入,光标会定位在最后一行。未能复现你的问题。你可以录个视频说明问题

回到顶部