feat(Slider): min、max、step can be string

This commit is contained in:
陈嘉涵
2020-01-30 10:13:41 +08:00
parent 7b6022d0e7
commit 02fbc2126a
3 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -15,15 +15,15 @@ export default createComponent({
activeColor: String,
inactiveColor: String,
min: {
type: Number,
type: [Number, String],
default: 0,
},
max: {
type: Number,
type: [Number, String],
default: 100,
},
step: {
type: Number,
type: [Number, String],
default: 1,
},
value: {
@@ -119,7 +119,7 @@ export default createComponent({
? event.clientY - rect.top
: event.clientX - rect.left;
const total = this.vertical ? rect.height : rect.width;
const value = (delta / total) * this.range + this.min;
const value = +this.min + (delta / total) * this.range;
this.startValue = this.value;
this.updateValue(value, true);