You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flowbite弹窗组件置于*ngIf条件块中无法显示(条件已满足)的问题求助

Flowbite弹窗组件置于*ngIf条件块中无法显示(条件已满足)的问题求助

各位大佬好,我最近在做Angular项目时碰到个棘手的问题:我把包含Flowbite弹窗触发按钮的app-success-reservation组件放在了*ngIf="!isLoading"的条件块里,明明isLoading已经切换为false,组件也成功渲染出来了,但点击按钮就是没法唤起弹窗。

先贴父组件里的相关代码:

<div *ngIf="!isLoading" class="flex w-full max-md:mt-5 items-center justify-end max-md:justify-end max-lg:justify-start">
    <app-success-reservation></app-success-reservation>
</div>

下面是app-success-reservation组件里的按钮核心代码:

<button data-modal-target="popup-modal" data-modal-toggle="popup-modal" type="button" class="flex items-center gap-2 mt-10 rounded-lg">
    <!-- 按钮内部内容省略 -->
</button>

我已经确认isLoading的状态确实变成了false,app-success-reservation组件也正常渲染,按钮的DOM元素在页面上是存在的,但点击就是没反应。我猜测会不会是因为这个组件是动态渲染出来的,Flowbite的弹窗没有正确初始化?有没有大佬遇到过类似的问题,或者能给点排查方向?

备注:内容来源于stack exchange,提问作者Pavel Kana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 16:24:50