我一直在努力塑造一个
BoxedComponent
来自
HeaderComponent
::ng-deep
,但我找不到一个合适的方法。
盒式组件
组件类只包含一个
ViewEncapsulation.None
@Component({
selector: 'labs-boxed',
templateUrl: './boxed.component.html',
styleUrls: ['./boxed.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class BoxedComponent {}
HTML
<div class="boxed">
<ng-content></ng-content>
</div>
我在它的SCSS文件中创建了两个类,可以在任何地方使用,但我意识到,由于同样的问题,我仍然无法对组件的响应进行样式化。
.boxed {
/* rules */
}
.tall .boxed {
height: 500px;
width: 360px;
}
.squared .boxed {
height: 340px;
width: 340px;
}
在里面
的HTML文件,我正在使用
labs-boxed
详情如下:
<div id="who-we-are" class="d-flex justify-content-around">
<labs-boxed [ngClass]="'tall'">
<p>
...
...
...
lab-boxed
的样式及其更改:
.盒装的{…}
等等,但没有成功。