AntD-如何对单个组件使用深色主题? [英] AntD - how to use dark theme for a single component?

查看:82
本文介绍了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?

推荐答案

您可以使用较少的引用导入功能来设置单个组件的主题.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);
}

通过进入参考文献: https://css-tricks.com/reference-imports-in-less-are-kinda-cool/

这篇关于AntD-如何对单个组件使用深色主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆