材质自动完成填充的数据未显示在字符输入中,而是在单击鼠标时显示?

问题描述

实际上这里有两个问题

  1. 如果输入字符串lenth大于三个字符,我正在尝试获取数据,这是按预期发生的。但 输入第四个字母后,结果数组应自动显示过滤器选项,但单击鼠标会显示列表。

  2. IAM在这里使用两个输入自动完成功能,在两种情况下,当用户选择选项时,IAM都会传递两个值($ event,'string')。 在两种情况下,其发送事件值正确无误,但对于其他字符,它总是将第二个输入值作为第二个参数发送。 请帮我解决这个问题。谢谢。

                           <input type="text" id="src" [formControl]="myControl" placeholder="Pick one"
                             (input)="initService($event)" aria-label="Number" matInput formControlName="source"
                             [matAutocomplete]="auto">
                           <mat-autocomplete #auto="matAutocomplete" (optionSelected)="stopselect($event,'s');">
                             <mat-option *ngFor="let option of predictionsNew" [value]="option">
                               {{option}}
                             </mat-option>
                           </mat-autocomplete>
    
    
                           <input type="text" id="dest" placeholder="Pick one" (input)="initService($event)"
                             (input)="initService($event)" aria-label="Number" matInput formControlName="destination"
                             [matAutocomplete]="auto">
                           <mat-autocomplete #auto="matAutocomplete" (optionSelected)="stopselect($event,'d');">
                             <mat-option *ngFor="let option of predictionsNew" [value]="option">
                               {{option}}
                             </mat-option>
                           </mat-autocomplete>
    
    
    
                         initService(event) {
                             this.predictionsNew = [];
                             if (event.target.value.length > 3) {
                               const displaySuggestions = function (
                                 predictions: google.maps.places.QueryAutocompletePrediction[],status: google.maps.places.PlacesServiceStatus,) {
                                 if (status != google.maps.places.PlacesServiceStatus.OK) {
                                   alert(status);
                                   return;
                                 }
                                 this.predictionsNew = [];
                                 for (let i = 0; i < predictions.length; i++) {
                                   this.predictionsNew.push(predictions[i].description);
                                 }
                                 return this.predictionsNew;
                               };
                               const service = new google.maps.places.AutocompleteService();
                               service.getQueryPredictions({ input: event.target.value },displaySuggestions.bind(this));
                             }
                           }
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...