定位解决,直接上代码
<el-switch
class="switch"
width='60'
v-model="status"
:active-value="0"
:inactive-value="1"
active-text="上架"
inactive-text="下架"
></el-switch>
css样式
.switch .el-switch__label {
position: absolute;
color: #fff !important;
z-index: 1;
display: none;
}
.switch .is-active{
display: block;
}
.switch .el-switch__label--left span{
margin-left: 20px;
}
效果图