📅  最后修改于: 2022-03-11 15:03:39.907000             🧑  作者: Mango
constructor(public elementRef: ElementRef, private renderer: Renderer)
{
this.renderer.setElementClass(this.elementRef, 'class');
// or
this.elementRef.nativeElement.classList.add('class');
}