textarea根据内容自动增加高度

来源:互联网 发布:结婚录像制作软件 编辑:程序博客网 时间:2024/05/15 01:55
<textarea v-model="cureInfo.Symptom" id="symptomTxt" oninput="autoTextAreaHeight(this)" ></textarea>

js处理:

    function autoTextAreaHeight(o) {        o.style.height = o.scrollTop + o.scrollHeight + "px";    }    $(function () {        var ele = document.getElementById("symptomTxt");        autoTextAreaHeight(ele);    })