私はionic指令を作成しようとしていましたが、それは機能しません。 ディレクティブが自動的にサイズを変更できるようにします。だから、それはちょうどサイズ変更を続けるテキストがより多くあるとき。Ionic 3指令が機能しない
これは私のコードです: 私のプロジェクトは、角度4、新しいバージョンを使用しているイオン3プロジェクトです。
import { Directive, HostListener, ElementRef } from '@angular/core';
@Directive({
selector: '[auto-resize-text-input]' // Attribute selector
})
export class AutoResizeTextInput {
constructor(public elem: ElementRef) {
console.log('Hello AutoResizeTextInput Directive');
}
@HostListener('input', ['$event.target']) onInput() {
this.resizeTextOnInput();
}
private resizeTextOnInput() {
this.elem.nativeElement.style.overflow = 'hidden';
this.elem.nativeElement.style.height = 'auto';
this.elem.nativeElement.style.height = this.elem.nativeElement.scrollHeight + "px";
}
}
お願いしますか?
こんにちは、あなたはその解決策を見つけましたか? – Yasir
まだ解決策が見つかりませんでした。イオンフォーラムにお問い合わせください。まだ解決策はありません。 –
うまくいけば、ここで答えを見つけることができます。https://chat.stackoverflow.com/rooms/153499/ionic-3 –