修改element-ui默认的开关样式

参考https://blog.csdn.net/WwangXue/article/details/90038947

默认样式:

 修改为:

CSS代码:

 .el-switch__core{
    height: 20px !important;
    line-height: 20px !important;
    width: 46px !important;
  }
.el-switch__label--left{
    position: relative;
    left: 46px;
    color: #fff;
    z-index: -1111;
  }
.el-switch__label--right{
    position: relative;
    right: 46px;
    color: #fff;
    z-index: -1111;
  }
.el-switch__label--right.is-active{
    z-index: 1111;
    color: #fff !important;
  }
.el-switch__label--left.is-active{
    z-index: 1111;
    color: #fff !important;
  }
.el-switch__core:after{
    top: 2px;
  }

 页面:

<el-switch class="exio-switch" active-text="开" inactive-text="关" active-color="#13ce66"></el-switch>

发布了73 篇原创文章 · 获赞 44 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_34928194/article/details/103807876
今日推荐