vue elementui Switch组件添加开关样式
![](https://img2022.cnblogs.com/blog/1472677/202211/1472677-20221118094904481-1662627119.png)
/deep/ .el-switch {
&::before {
content: '开';
display: none;
color: #fff;
z-index: 1;
margin-right: -12px;
transform: translateX(7px);
font-size: 12px;
}
&::after {
color: #fff;
content: '关';
z-index: 1;
margin-left: -15px;
transform: translateX(-4px);
font-size: 12px;
}
&.is-checked::before {
display: block;
}
&.is-checked::after {
display: none;
}
}