Skip to content

Commit

Permalink
fix(slider/types): fix template types
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Oct 17, 2021
1 parent ad3eb81 commit 31da191
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions packages/varlet-ui/src/slider/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
class="var-slider-block"
:class="[isDisabled ? 'var-slider__disable' : null, errorMessage ? 'var-slider__error' : null]"
:style="{
height: `${3 * thumbSize}px`,
margin: `0 ${thumbSize / 2}px`,
height: thumbSize === undefined ? thumbSize : `${3 * toNumber(thumbSize)}px`,
margin: thumbSize === undefined ? thumbSize : `0 ${toNumber(thumbSize) / 2}px`,
}"
ref="sliderEl"
@click="click"
Expand All @@ -26,7 +26,7 @@
:key="item.enumValue"
:style="{
left: `${item.value}%`,
zIndex: thumbsProps[item.enumValue].active ? 1 : null,
zIndex: thumbsProps[item.enumValue].active ? 1 : undefined,
}"
@touchstart="start($event, item.enumValue)"
@touchmove="move($event, item.enumValue)"
Expand All @@ -47,8 +47,18 @@
:class="[thumbsProps[item.enumValue].active ? 'var-slider__thumb-ripple-active' : null]"
:style="{
background: thumbColor,
height: thumbSize ? (thumbsProps[item.enumValue].active ? 3 * thumbSize + 'px' : '0px') : null,
width: thumbSize ? (thumbsProps[item.enumValue].active ? 3 * thumbSize + 'px' : '0px') : null,
height:
thumbSize === undefined
? undefined
: thumbsProps[item.enumValue].active
? `${3 * toNumber(thumbSize)}px`
: '0px',
width:
thumbSize === undefined
? undefined
: thumbsProps[item.enumValue].active
? `${3 * toNumber(thumbSize)}px`
: '0px',
}"
></div>
<div
Expand All @@ -57,8 +67,8 @@
:style="{
background: labelColor,
color: labelTextColor,
height: 2 * thumbSize + 'px',
width: 2 * thumbSize + 'px',
height: thumbSize === undefined ? thumbSize : `${2 * toNumber(thumbSize)}px`,
width: thumbSize === undefined ? thumbSize : `${2 * toNumber(thumbSize)}px`,
}"
>
<span>{{ item.value }}</span>
Expand Down Expand Up @@ -330,6 +340,7 @@ export default defineComponent({
errorMessage,
thumbsProps,
thumbList,
toNumber,
showLabel,
start,
move,
Expand Down

0 comments on commit 31da191

Please sign in to comment.