HTMLコードに押されたキーを入力した後に観察更新する方法</p> <pre class="lang-html prettyprint-override"><code><input type="text" data-bind="value: nextName"> </code></pre> <p>観察可能なInternet Explorerの
nextName: KnockoutComputed<string>;
currentName: KnockoutObservable<string>;
constructor()
{
this.nextName = ko.pureComputed(
{
read:() => this.currentName(),
write: (value: string) =>
{
this.currentName(value);
if ((value) && value.trim().length > 0)
this.runSearch();
}
}, this);
}
ユーザーは、Enterキーを押した後 - 検索は、たとえばChromeで正常に実行されますが、いないでインターネットエクスプローラ。
私はvalueUpdate:'afterkeydown'
でバインディングを使用しようとしましたが、これはすべての文字の後に検索を実行します。これは達成しようとしたものではありません。