自定义el-switch文字显示位置

在这里插入图片描述

<!--
 * @Descripttion: appid管理技术后台(正式环境)
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2021-04-12 15:27:34
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-04-27 10:08:15
-->
<el-switch
    class="switch"
    v-model="scope.row.enabled"
    active-color="#13ce66"
    inactive-color="#ff4949"
    active-value="ENABLED"
    inactive-value="DISABLE"
    active-text="启用"
    inactive-text="禁用"
    @change="changStatus($event, scope.row)"
  >
    >
  </el-switch>

/* switch按钮样式 */
/deep/.switch .el-switch__label {
    position: absolute;
    display: none;
    color: #fff !important;
}
/*打开时文字位置设置*/
/deep/.switch .el-switch__label--right {
    z-index: 1;
}
/* 调整打开时文字的显示位子 */
/deep/.switch .el-switch__label--right span{
    margin-right: 9px;
}
/*关闭时文字位置设置*/
/deep/.switch .el-switch__label--left {
    z-index: 1;
}
/* 调整关闭时文字的显示位子 */
/deep/.switch .el-switch__label--left span{
    margin-left: 9px;
}
/*显示文字*/
/deep/.switch .el-switch__label.is-active {
    display: block;
}
/* 调整按钮的宽度 */
/deep/.switch.el-switch .el-switch__core,
/deep/.el-switch .el-switch__label {
     width: 70px !important;
     margin: 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值