AntDV中a-input的默认样式修改

AntDV中a-input的默认样式修改

UI稿有修改a-input样式的需求,调整代码如下:

基本外观样式(背景颜色,字体颜色,placeholder颜色):

/deep/ .ant-input{
    background-color: rgba(0,0,0,.3);
    color: #4091FF;
    border: 1px solid rgba(0,0,0,.3);
    &::placeholder {
      color: #4091FF;
    }
  }

谷歌浏览器的自动填充会覆盖掉写好的样式,用延时动画保证我们的颜色:

/deep/ input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active {
    -webkit-transition-delay: 99999s;
    -webkit-transition: color 99999s ease-out, background-color 99999s ease-out;
  }

由于我的a-input是登录页使用的,存在表单验证,输入错误时表单验证也会覆盖掉设置的样式:

/deep/ .has-error .ant-input-affix-wrapper .ant-input, .has-error .ant-input-affix-wrapper .ant-input:hover{
    background-color: rgba(0,0,0,.3) !important;
    color: #4091FF !important;
  }

由于我自定了一个输入框的前置图标,输入文本和图标有点挤,所以加了点距离

/deep/ .ant-input-affix-wrapper .ant-input:not(:first-child) {
    padding-left: 40px;
  }

基本样式如图

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值