这是我第一次在Angular中使用Bootstrap的carousel元素,我遇到了一个奇怪的问题,在每次转换之前都会出现一个白色的幻灯片(参见下面的gif )。我按照ng-bootstrap Github页面上的所有基本步骤进行设置,但我找不到问题所在。以下是相关文件:
当前问题的Gif:https://ibb.co/p38LP4X
home.html
...
<ngb-carousel *ngIf="images" [interval]="5000" [pauseOnHover]="pauseOnHover" [pauseOnFocus]="pauseOnFocus">
<ng-template ngbSlide *ngFor="let img of images; index as i">
<div class="carousel-caption">
<h1>AS SOLID AS THEY COME</h1>
</div>
<div class="img-wrapper">
<img [src]="img" alt="My image {{i + 1}} description">
</div>
</ng-template>
</ngb-carousel>
...angular.json
...
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
...我还在index.html中包含了另一个引导程序版本,因为只使用angular.json中的引导程序版本根本不会使carousel起作用。
index.html
<head>
...
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />
...
</head>发布于 2021-08-04 06:27:50
我也遇到了同样的问题,从../node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file位置删除ngcc_lock_file文件对我很有效。
https://stackoverflow.com/questions/67749702
复制相似问题