【问题标题】:click function doesn't work anymore after I change the html更改html后点击功能不再起作用
【发布时间】:2022-01-07 08:41:17
【问题描述】:

我有一个打开模式和对象的 uuid 的点击功能,在我更改了该功能在 html 中的标记后它停止工作,它会是什么?

ps:我必须把图标放在轮播滑块的中间才能让它出现在屏幕上

我的函数和我的 html:

openBannerDeleteModal(uuid ? : string): void {
  if (!uuid) return;
  const width = innerWidth <
    1024 ? '100%' : '40%';
  const dialogRef = t his.matDialog.open(BannerDeleteComponent, {
    height: '20%',
    width: width,
    data: {
      uuid: uuid,
    },
  });
  dialogRef.afterClosed().subscribe(async(result) => {
    if (result) this.banners = await this.BannerService.getBanner();
    window.location.reload();
  });
}

<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
  <span class="carousel-control-prev-icon" aria-hidden="true">
                    </span>
  <span class="sr-only">Previous</span>
</a>
<i (click)="openBannerDeleteModal(banner.uuid)" *ngIf="isAdminFlag==='true'" class="fas fa-trash-alt delete-modal" id="banner-delete" aria-hidden="true"></i>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
  <span class="carousel-control-next-icon" aria-hidden="true">
                    </span>
  <span class="sr-only">Next</span>
</a>
</div>
</div>

以前的版本是:

<div class="carousel-inner">
  <div class="banner carousel-item {{ i === 0 ? 'active' : '' }} it-1" *ngFor="let banner of banners; let i = index">
    <div id="tilt" class=" tiltElement carousel-caption">

      <i (click)="openBannerDeleteModal(banner.uuid)" *ngIf="isAdminFlag==='true'" class="fas fa-trash-alt delete-modal" id="banner-delete" aria-hidden="true"></i>

      <div class="vertical-line"></div>
      <div>

【问题讨论】:

  • 之前是什么?
  • 你还没有粘贴,openBannerDeleteModal
  • 您可以在问题本身中更新它
  • 完成问题!

标签: javascript html css angular typescript


【解决方案1】:

很可能您无法单击图标本身,您可以看到图标但可能有透明元素覆盖它,您可以使用荧光笔检查是否是这种情况

【讨论】:

    猜你喜欢
    相关资源
    最近更新 更多
    热门标签