简体   繁体   English

Antd:如何设置按钮hover颜色?

[英]Antd: how to set button hover color?

I have the following configuration in the antd.customize.less file:我在antd.customize.less文件中有如下配置:

@btn-primary-bg: #ffe900;
@btn-primary-color: @primary-color;

@btn-default-color: @primary-color;
@btn-default-bg: #ffffff;

On hovering a primary button everything is ok, but on hovering a default button the text color in the button changes to @btn-primary-bg, which I want to override, but I couldn't find any property like "@btn-default-hover-color" here .在悬停主按钮时一切正常,但在悬停默认按钮时,按钮中的文本颜色更改为@btn-primary-bg,我想覆盖它,但我找不到任何属性,如“@btn-default -悬停颜色” 在这里 How can this be overridden, if at all?这怎么能被覆盖,如果有的话?

I faced the same issue but I'm still looking for a better solution.我遇到了同样的问题,但我仍在寻找更好的解决方案。 However, for the moment, I can suggest that you add something like this to your global style file:但是,目前,我可以建议您在全局样式文件中添加如下内容:

.ant-btn-default:hover, .ant-btn-default:focus {
  border-color: #bee2e5;
  color: #fff;
}

Working with reassigning less variables .使用重新分配更少的变量 Thied to edit everything that connected with @primary-color, nothing changed color generated by Antd for hover/active state. Looks like there is no way to do this with less variables.试图编辑与@primary-color 相关的所有内容,Antd 为悬停/活动 state 生成的颜色没有任何变化。看起来没有办法用更少的变量来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM