Ant Design 的 Input 输入框组件在获取焦点时会有蓝色的边框,尝试用 outline:none 去掉这个边框,但是发现不管用。
outline:none
最终通过 F12 调试发现 Ant Design 的 Input 组件在获取焦点时蓝色边框是通过 box-shadow 来实现的。
box-shadow
解决方法: 通过CSS样式覆盖原始效果
.ant-input:focus { border: none; box-shadow: none; }
为了防止误伤,可以这样写:
.ant-input-affix-wrapper .ant-input:focus { border: none;