Javascript 根据内容在angular 2中自动调整textarea的大小?
所以我有Javascript 根据内容在angular 2中自动调整textarea的大小?,javascript,angular,Javascript,Angular,所以我有textarea,我希望在开始时有一行,并根据内容展开。有什么建议我该怎么做 var s_height = document.getElementById('note').scrollHeight; document.getElementById('note').setAttribute('style','height:'+s_height+'px'); 我有这个小提琴,但我不想添加滚动,我想在文本区域添加高度。有什么建议我该怎么做 var s_height = document.g
textarea
,我希望在开始时有一行,并根据内容展开。有什么建议我该怎么做
var s_height = document.getElementById('note').scrollHeight;
document.getElementById('note').setAttribute('style','height:'+s_height+'px');
我有这个小提琴,但我不想添加滚动,我想在文本区域添加高度。有什么建议我该怎么做
var s_height = document.getElementById('note').scrollHeight;
document.getElementById('note').setAttribute('style','height:'+s_height+'px');
我个人用过。它会自动执行此操作。找不到@angular/material模块,因为您必须安装、导入它,等等。阅读他们的指南(左上角,点击指南)