方法一:在css中设置样式 for CSS added to the component :host ::ng-deep mySelector { background-color: blue; } for CSS added to index.html body ::ng-deep mySelector { background-color: green; } 方法二:在ng生命周期中设置样式 使用方法二,我们得了解ng4的生命周期:经过测试,在ngAfterViewChecked方法中可以设…