Angular 的 renderer2 不会应用线性渐变 CSS。谁能看到我错过了什么?
export class AppComponent implements OnInit {
constructor(private renderer: Renderer2, private elementRef: ElementRef) {}
public ngOnInit(): void {
this.renderer.setStyle(
this.elementRef.nativeElement,
"background",
"linear-gradient(rgba(253,92,99,1), rgba(144,255,0,1) 30%);"
// "red" // works, so does this rule in CSS
);
}
}
这是一个stackblitz repro