angular:封装步进组件

时间:2020-02-19 16:20:41

标签: angular angular-material shadow-dom color-picker

我在同时使用Mater-Stepper和ngx-color-picker时遇到问题。在步进器中,内容将在.mat-horizontal-content-containeroverflow: hidden中找到。结果,拾色器仅在步进器内容中可见,而某些部分可能不可见。

我在CSS中找到的解决方案:

::ng-deep .mat-horizontal-content-container {
    overflow: visible !important;
}

不过,根据https://github.com/angular/angular/issues/25160 ng-deep可能很快将不再受支持。帖子(https://github.com/angular/angular/issues/25160#issuecomment-504642697)的解决方案是:

1. define a class on the component's container element
2. set the component to encapsulation: ViewEncapsulation.None
3. wrap all styles in the component (SCSS) with the class of the component's container element
4. target any selectors that you want in the library component

我是新手,我了解它应该通过禁用其中的阴影dom将MatStepper包装到自定义组件中。

对吗?我们应该如何通过保留其所有功能来包装现有组件?

谢谢。

0 个答案:

没有答案