2023.3.31每日总结

发布时间 2023-03-31 20:11:04作者: 超爱彬宝同学

今天学习了text area实现输入框随着文字的输入增长

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生作业提交页面</title>

    <style type="text/css">
        .txt{
            border: none;
            outline: none;
            font-size: 16px;
            display: block;
            width: 100%;
            resize: none;
           line-height: 2;
            background: inherit;
        }
    </style>
    <template>
        <textarea @input="handleChange" class="txt" rows="1"></textarea>
    </template>
    <script>
        function handleChange(e) {
            const textarea=e.target();
            textarea.style.height=textarea.scrollHeight+'px';
        }
    </script>

</head>
<body>
<textarea class="txt" placeholder="回复内容"></textarea>
</body>
</html>