【发布时间】:2021-07-07 06:45:12
【问题描述】:
我创建了一个<a> 标记,它还提供了一个(click) 事件函数调用。
点击在任何地方都有效,即使对于所有子元素,除了以下箭头垫图标(完整视图请参见下面的代码):
<span *ngIf="section.pages.length>0">
<mat-icon *ngIf="section.id==id_focus">keyboard_arrow_down</mat-icon>
<mat-icon *ngIf="section.id!=id_focus">keyboard_arrow_right</mat-icon>
</span>
我在这一切中做错了什么?
我的代码:
<a mat-list-item class="text-light listitem" (click)="switchSub(section.id)" (mouseenter)="expandSub(section.id)">
<div class="row">
<div class="col-xs-2">
<!--CLICK NOT WORKING FROM HERE...-->
<span *ngIf="section.pages.length>0">
<mat-icon *ngIf="section.id==id_focus">keyboard_arrow_down</mat-icon>
<mat-icon *ngIf="section.id!=id_focus">keyboard_arrow_right</mat-icon>
</span>
<!--...TO HERE-->
<ng-container *ngIf="section.pages.length<=0">
</ng-container>
</div>
<div class="col-xs-3">
<span><mat-icon>{{section.icon}}</mat-icon></span>
</div>
<div class="col-xs-7">
<span *ngIf="isExpanded"> {{section.name}} </span>
</div>
</div>
</a>
页面视图
其中(click)在蓝色方块上不起作用,也就是上面提到的材质图标。在其他任何地方,它都有效。
蓝色方块正确定位在父框内。
【问题讨论】:
-
您是否在 DOM 中检查了这些元素是否正在呈现?
-
同时检查这些图标的
z-index -
嗨@PardeepJain!是的,我向您确认元素在 DOM 中正确呈现
-
@PardeepJain 我用三个值编辑了 z-index:-1000、0 和 1000,但页面行为没有任何变化
-
你能在 stackblitz 上重现你的问题吗?在那里整理会更容易
标签: html angular angular-material