是因为使用了::focus可以: clickHandler(evt) { let target = evt.target; if(target.nodeName == "SPAN"){ target = evt.target.parentNode; } target.blur(); }或者重写样式:<el-button class="buttonDiv" size="small">查询</el-button> <el-button class="buttonDiv" size="small">重置</el-button>/*鼠标点击后移开,恢复本身样式*/ .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; }
是因为使用了:
:focus
可以:
或者重写样式: