fix(Slider): incorrect bar-height when vertical (#6065)

This commit is contained in:
neverland
2020-04-16 16:23:32 +08:00
committed by GitHub
parent 455be42c11
commit 63f789646d
4 changed files with 22 additions and 11 deletions
+6 -6
View File
@@ -148,16 +148,16 @@ export default createComponent({
render() {
const { vertical } = this;
const style = {
background: this.inactiveColor,
};
const mainAxis = vertical ? 'height' : 'width';
const crossAxis = vertical ? 'width' : 'height';
const wrapperStyle = {
background: this.inactiveColor,
[crossAxis]: addUnit(this.barHeight),
};
const barStyle = {
[mainAxis]: `${((this.value - this.min) * 100) / this.range}%`,
[crossAxis]: addUnit(this.barHeight),
background: this.activeColor,
};
@@ -167,7 +167,7 @@ export default createComponent({
return (
<div
style={style}
style={wrapperStyle}
class={bem({ disabled: this.disabled, vertical })}
onClick={this.onClick}
>