ElemeFE / element-angular

Element for Angular
https://element-angular.faas.ele.me
MIT License
530 stars 121 forks source link

How to set step for el-slider #126

Closed ft115637850 closed 4 years ago

ft115637850 commented 6 years ago

Issue Type:

Description: I want to set step for el-slider. How can I do this ?

w-xuefeng commented 6 years ago

you can use a function to bind to [format-tooltip], which will return an anonymous function with a parameter to calculate your step. like this:

<el-slider [min]="1" [max]="9" [model]="data" [format-tooltip]="sliderFormat()"></el-slider>
  sliderFormat() {
    return function (val) {
      return (val * 10).toString();
    }
  }

This will achieve the ten-step with one slide.

Tumiz commented 5 years ago

It is a bug, element ui always take this property as a String, but only Number is accepted.