【发布时间】:2021-08-10 06:45:38
【问题描述】:
在我的离子5的应用程序当ion-textarea与autoGrow="true"变长的高度,它总是滚动到上输入顶部,当用户的输入超出屏幕的高度。 here 报告了这个确切的问题,据说该修复程序已合并 here。
我的 Ionic 版本是 6.16.1,我正面临这个问题。问题可以查here
【问题讨论】:
标签: ionic-framework textarea ionic5 autogrow
在我的离子5的应用程序当ion-textarea与autoGrow="true"变长的高度,它总是滚动到上输入顶部,当用户的输入超出屏幕的高度。 here 报告了这个确切的问题,据说该修复程序已合并 here。
我的 Ionic 版本是 6.16.1,我正面临这个问题。问题可以查here
【问题讨论】:
标签: ionic-framework textarea ionic5 autogrow
通过检查您共享的链接,这个答案似乎适用于您的 stackblitz:https://github.com/ionic-team/ionic-framework/pull/19776#issuecomment-549735550
在您的 html 中:
<ion-textarea auto-grow="true" (ionInput)="onTextInput($event)"> </ion-textarea>
在您的 .ts 文件中:
onTextInput(event) { event.target.getInputElement().then((textArea: HTMLTextAreaElement) => { console.log(textArea.textLength + " : " + textArea.value); textArea.scroll({top: textArea.scrollHeight}); }); }
【讨论】: