Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
Element-UI Button 点击后背景色如何消失?_创想鸟

Element-UI Button 点击后背景色如何消失?

element-ui button 点击后背景色如何消失?

element-ui button 点击背景色后如何鼠标移开消失

element-ui 的 button 点击后会有一个背景色,但点击其他地方后,背景色不会消失。本文将探讨如何让鼠标移开后背景色立即消失。

类似这样:

点击空白区域变为白色

造成背景色无法消失的原因在于

:focus 的使用。

image.png

我们可以使用以下 javascript 代码解决此问题:

clickhandler(evt) {    let target = evt.target;    if(target.nodename == "span"){        target = evt.target.parentnode;    }    target.blur();}

或者,修改 css 样式:

查询重置
/*鼠标点击后移开,恢复本身样式*/.buttonDiv, .buttonDiv:focus:not(.buttonDiv:hover){     margin-right: 12px;    border: 1px solid #2794f8;    border-radius: 2px;    box-shadow: 0 2px 4px 0 #f4f4f4;    color: #2794f8;    background: white;}/*鼠标悬浮,没有按下;鼠标按下后抬起,没有移开*/.buttonDiv:focus, .buttonDiv:hover{    background: #eaf5ff;    border: 1px solid #2794f8 !important;    color: #2794f8;}/*鼠标按下,没有抬起*/.buttonDiv:active {    background: #2794f8;    color: white;}

以上就是Element-UI Button 点击后背景色如何消失?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1631945.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
使用 raw-loader 引入 TailwindCSS 样式后,样式无法打包,如何解决?
上一篇 2025年12月24日 14:37:33
为什么H标签会溢出div背景?
下一篇 2025年12月24日 14:37:42

相关推荐

发表回复

登录后才能评论
关注微信