调整generate输入框出现滚动条问题

This commit is contained in:
X1627315083
2026-01-13 16:16:02 +08:00
parent d75e956fbf
commit bc7099cce2
12 changed files with 379 additions and 177 deletions

View File

@@ -1074,10 +1074,10 @@ export default defineComponent({
const scrollTop = textarea.scrollTop
// 2. 计算单行高度
const lineHeight = parseInt(getComputedStyle(textarea).lineHeight) || 20 // 默认20px
const lineHeight:any = parseInt(getComputedStyle(textarea).lineHeight) || 20 // 默认20px
// 3. 重置高度为1行
textarea.style.height = lineHeight + 'px'
textarea.style.height = (parseInt(lineHeight)+4) + 'px'
// 4. 计算实际需要的高度
const newHeight = Math.max(lineHeight, textarea.scrollHeight)