elementui 开关文字显示在开关里面

  • 效果图

  • 在app.vue中直接添加一下代码即可
    在这里插入图片描述

<style lang="scss">
  .el-switch__label--left {
    position: relative;
    left: 45px;
    color: #fff;
    z-index: -1111;
  }
  .el-switch__core{
    width: 50px !important;
  }
  .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: #9c9c9c !important;
  }

</style>
  • 开关上的字改为 开 关

active-text=“开”
inactive-text=“关”

posted @ 2020-09-17 20:02  HumorChen99  阅读(4)  评论(0编辑  收藏  举报  来源