HTML 代码:
<ngx-select [items]="items" [noAutoComplete]="true" [(ngModel)]="itemId" placeholder="No city selected" (focus)="doFocus()"
(blur)="doBlur()" (open)="doOpen()" (close)="doClose()" (select)="doSelect($event)" (remove)="doRemove($event)"
(selectionChanges)="doSelectOptions($event)"></ngx-select>
TS代码:
public items: string[] = ['Amsterdam', 'Antwerp', 'Athens', 'Barcelona',
'Berlin', 'Birmingham', 'Bradford', 'Bremen', 'Brussels', 'Bucharest',
'Budapest', 'Cologne', 'Copenhagen', 'Dortmund', 'Dresden', 'Dublin',
'Düsseldorf', 'Essen', 'Frankfurt', 'Genoa', 'Glasgow', 'Gothenburg',
'Hamburg', 'Hannover', 'Helsinki', 'Kraków', 'Leeds', 'Leipzig', 'Lisbon',
'London', 'Madrid', 'Manchester', 'Marseille', 'Milan', 'Munich', 'Málaga',
'Naples', 'Palermo', 'Paris', 'Poznań', 'Prague', 'Riga', 'Rome',
'Rotterdam', 'Seville', 'Sheffield', 'Sofia', 'Stockholm', 'Stuttgart',
'The Hague', 'Turin', 'Valencia', 'Vienna', 'Vilnius', 'Warsaw', 'Wrocław',
'Zagreb', 'Zaragoza', 'Łódź'];
public doFocus = () => console.log('SingleDemoComponent.doFocus');
public doBlur = () => console.log('SingleDemoComponent.doBlur');
public doOpen = () => console.log('SingleDemoComponent.doOpen');
public doClose = () => console.log('SingleDemoComponent.doClose');
public doSelect = (value: any) => console.log('SingleDemoComponent.doSelect', value);
public doRemove = (value: any) => console.log('SingleDemoComponent.doRemove', value);
public doSelectOptions = (options: INgxSelectOption[]) => console.log('SingleDemoComponent.doSelectOptions', options);
即使按照所有步骤操作,列表也不可见。我将 ul 列表的 CSS 更改为 opacity: 1 .... 默认情况下它是 opacity:0。
有谁知道这里有什么问题?
我在这里关注的链接是
Angular ngx-选择