参考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>