<textarea @input="handleChange" rows="1" class="txt"></textarea>
const handleChange = (e) => {
const textarea = e.target
textarea.style.height = 'auto' //默认先设置自动高度
textarea.style.height = textarea.scrollHeight + 'px'
}
<textarea @input="handleChange" rows="1" class="txt"></textarea>