AntD - 如何为单个组件使用深色主题? [英] AntD - how to use dark theme for a single component?
本文介绍了AntD - 如何为单个组件使用深色主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以组件库有一个黑暗的主题.
我只想对单个组件使用深色样式,例如 Popover
.其余所有 sd 保持默认.
有没有办法做到这一点?
So the component lib has a dark theme.
I would like to use dark style only for a single component, say a Popover
. All the rest sd remain default.
Is there a way to achieve that?
推荐答案
您可以使用较少的 reference import
功能为单个组件进行主题化.Sudo 代码类似于
you could use less reference import
feature for theming single component. Sudo code would be something like
@import (reference) "@ant-design/dark-theme"
.my-popover {
&:extend(@popover-prefix-cls all);
}
你可以通过进入单个组件样式文件并检查类
you can find the class name @popover-prefix-cls
by going into individual components styles file and checking the class
参考:https://css-tricks.com/reference-imports-in-less-are-kinda-cool/
这篇关于AntD - 如何为单个组件使用深色主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文