textarea高度自动改变

直接上代码

<textarea placeholder="手动输入" @keyup="autoHeight($event)"></textarea>
autoHeight:function(event){
                var txtarea=event.target;
                txtarea.style.height='auto';
                txtarea.style.height=txtarea.scrollHeight+"px";
            }

经测试好用

posted @ 2018-03-08 15:00  a露露  阅读(137)  评论(0编辑  收藏  举报