我得到了以下代碼
<mat-form-field appearance="fill" style="margin: 0px 20px;font-size:13px;">
<input matInput type="text" aria-label="Number" placeholder="{{'Home.search' | translate }}"
[formControl]="myControl" [matAutocomplete]="auto" (ngModelChange)="getByKeyword($event)">
<mat-option *ngFor="let testCity of testCities" [value]="testCity.city"
(click)="testFunction(testCity.city, testCity.countryIso, testCity.cityId)">
我想知道,有沒有一種方法可以在沒有(單擊)的情況下呼叫“testFunction”,而是使用檢測到輸入欄位不再懸停或輸入每個新字母實體的東西?
uj5u.com熱心網友回復:
使用“mouseleave”事件(與“click”相同)在停止懸停時執行功能。為了檢測打字,您可以使用“keydown”或“keyup”事件。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/479150.html
