繁体   English   中英

如何调整垫子的位置

[英]How adjust the position of mat-option

我正在运行角度应用程序,我有自动完成字段,我想调整此位置。 我在方法的updatePosition下引用了官方文档的输入链接描述 -更新自动完成建议面板的位置,以确保它适合视口内的所有选项。

我不确定如何使用

这是我的template.html

 <mat-form-field [style.cursor]="pointer" [style.cursor]="pointer" [style.width.px]=300  >
     <input class="selectCustomer" class="selectCustomerData" id="inputCustomer" matInput [matAutocomplete]="auto"  [formControl]="customerFilterControl" [(ngModel)]="customerName">
     <mat-icon matSuffix>keyboard_arrow_down</mat-icon>
       <p id="spandiv">{{customerName}}</p>  
     <mat-autocomplete dropdown-arrow="true" panelWidth ="450px" #auto="matAutocomplete" [displayWith] = "displayFn">
        <mat-option class="CustomerDropDown" *ngFor="let customer of filteredOptions | async"   [value] ="customer.AccountID +' '+'('+ customer.AccountName + ')'" (onSelectionChange)="onCustomerChange(customer)">
         {{customer.AccountID}} ({{customer.AccountName}})  <p id="spandiv1">{{customer.AccountID}} ({{customer.AccountName}})</p> 
        </mat-option>
    </mat-autocomplete>
  </mat-form-field>

如下图所示,我希望垫子选项向左一点移动

在此处输入图片说明

如此图所示,突出显示的类总是向左应用样式:779px,但我想保持atv 775px

在此处输入图片说明

我能够使用


.mat-autocomplete-panel { 
  position:relative;
  right:3px;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM