我尝试了Stack Overflow上现有的答案,只是简单地更改“.tooltip-inner”样式。但是我仍然看到默认的黑色背景。
我尝试的CSS:
.tooltip-inner {
background-color: pink !important;
}
带有工具提示的HTML:
<strong #customTooltip="bs-tooltip" tooltip="Click below on your options" placement="bottom">Some Text</strong>
<img class="card-img-top card-image" (click)="onProvinceCardClick()"
组件:
import { Component, ViewChild, Input } from '@angular/core';
import { TooltipDirective } from 'ngx-bootstrap';
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss']
})
export class CardComponent {
@ViewChild('customTooltip') tooltip: TooltipDirective;
onCardClick() {
this.tooltip.toggle();
}
}