我尝试了一些东西,但似乎都没有。问题是因为这个
<div class="items" *ngFor="let infection of missionData?.infections; let i = index;"
(mouseenter)="infection.hover=true;"
(mouseleave)="infection.hover=false;">
<sat-popover #infectionPopovers xAlign="center" yAlign="below">
<div class="custom-tip small-tip">
<div class="header">
{{hoveredInfection?.tip}}
</div>
</div>
</sat-popover>
<span class="name">{{infection.infection?.name}}</span>
<span class="device-status">
<app-svg-icon
*ngIf="infPopovers?.first"
(mouseenter)="hoveredInfection = infection;getInfectionPopover(i).open();"
(mouseleave)="hoveredInfection = null;getInfectionPopover(i).close();"
[satPopoverAnchorFor]="getInfectionPopover(i)" [name]="infection.infection.state" [size]="18"></app-svg-icon>
</span>
</div>
infPopovers 被定义为QueryList<SatPopover>
@ViewChildren('infectionPopovers') public infPopovers: QueryList<SatPopover>;
这就是 getInfectionPopover(index) (也许有必要理解)
getInfectionPopover(index): SatPopover{
return this.infPopovers.find((p, i) => i === index);
}
实际上一切正常,但我只想摆脱这个错误。