vue改变elementUI中el-slider中默认样式,显示数值或文字,改变文字颜色

89 篇文章 1 订阅
84 篇文章 1 订阅

改变el-slider中默认样式

通过deep对需要更改的样式进行更改

:deep(.el-slider__bar) {
  background-color: #00BBFF;
}

:deep(.el-slider__button) {
  border: 4px solid #167FFF;
  opacity: 0.6;
  background-color: #FFFFFF;
  /* 测试 */
  margin-left: 5px;
}

 :deep(.el-slider__marks-text) {
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #FFFFFF;
  font-size: 17px;
}
:deep(.el-slider) {
  width: 190px;
  height: 6px;
  position: relative;
  top: -14px;
  left: 2px;
}

显示数值或文字

data(){
    return{
        weather: {
        0: {
          style: {
            color: '#00BBFF',
            fontWeight: 'bold',
          },
          label: '晴', //设置需要显示的文字内容或者是数值
        },
        10: {
          style: {
            color: '#fff',
            fontWeight: '400'
          },
          label: '雨',
        },
        // 20: {
        //   style: {
        //     color: '#fff',
        //     fontWeight: '400'
        //   },
        //   label: '云',
        // },
        20: {
          style: {
            color: '#fff',
            fontWeight: '400'
          },
          label: '雪',
        },
        30: {
          style: {
            color: '#fff',
            fontWeight: '400'
          },
          label: '雾',
        }
      },
    }
}

改变文字颜色

//value1是slider绑定的数值
this.weather[this.value1].style.color = '#00BBFF'
this.weather[this.value1].style.fontWeight = 'bold'
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值