[improvement] Slider: support number type of bar-height prop (#3794)

This commit is contained in:
neverland
2019-07-09 17:02:05 +08:00
committed by GitHub
parent 06cf48c4c5
commit 7caf664e48
5 changed files with 27 additions and 6 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
import { createNamespace } from '../utils';
import { createNamespace, addUnit } from '../utils';
import { TouchMixin } from '../mixins/touch';
import { preventDefault } from '../utils/dom/event';
@@ -29,8 +29,8 @@ export default createComponent({
default: 0
},
barHeight: {
type: String,
default: '2px'
type: [Number, String],
default: 2
}
},
@@ -126,7 +126,7 @@ export default createComponent({
const barStyle = {
[mainAxis]: `${((this.value - this.min) * 100) / this.range}%`,
[crossAxis]: this.barHeight,
[crossAxis]: addUnit(this.barHeight),
background: this.activeColor
};