我有一個(gè)角組件按鈕,它使用了類(lèi)& quot按鈕-自定義& quot。
& ltbutton matInput class = & quot按鈕-自定義& quot& gt測(cè)試& lt/button & gt;
樣式為:button.component.scss
// SOLUTION 1 : need !important
.button-custom {
@include button-custom;
}
// SOLUTION 2 : do not need !important
:host {
@include button-custom;
}
和全球主題。scss:
// SOLUTION 2
@mixin button-custom() {
.button-custom {
... my properties
}
}
// SOLUTION 1
@mixin button-custom() {
... my properties
}
解決方案2不需要!與解決方案1相反的重要特性。為什么?