gpt4 book ai didi

html - Angular 组件如何使用用户定义的样式表?

转载 作者:太空宇宙 更新时间:2023-11-03 22:56:47 25 4
gpt4 key购买 nike

假设我创建了一个名为 button 的 Angular 组件,并且我希望用户在他们的应用程序中实现它来设置按钮的颜色。除了使用 Input() 装饰器之外还有其他方法吗?

最佳答案

我唯一的替代方法是使用 ng::deep 。但请记住,此功能将变为 deprecated很快!

下面是如何使用它的示例。

app.component.html:

<my-component>
<another-component>
<div class="buton"></div>
</another-component>
</my-component>

my-component.component.scss:

.someclasse ::ng-deep {
.button {
background-color: white;
}
}

关于html - Angular 组件如何使用用户定义的样式表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59950745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com