auto textarea height

This commit is contained in:
2023-03-25 12:38:48 +08:00
parent 61c4f548f1
commit 6b4cbd62ac

View File

@@ -224,6 +224,7 @@ export default function ChatBOX(props: {
</div> </div>
<div className="flex justify-between"> <div className="flex justify-between">
<textarea <textarea
rows={Math.min(10, (inputMsg.match(/\n/g) || []).length + 2)}
value={inputMsg} value={inputMsg}
onChange={(event: any) => setInputMsg(event.target.value)} onChange={(event: any) => setInputMsg(event.target.value)}
onKeyPress={(event: any) => { onKeyPress={(event: any) => {