Skip to content

Commit

Permalink
feat: Improve the slot when the tooltip is merged
Browse files Browse the repository at this point in the history
  • Loading branch information
NightCatSama committed Sep 29, 2018
1 parent 1231880 commit e08278b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ prop*: [only supported in vue2]
### Slot
| Name | Description |
| --------------|--------------|
| tooltip | Customize the tooltip slot. optional value: [`value`, `index`, `disabled`(only range model)] |
| tooltip | Customize the tooltip slot. optional value: [`value`, `index`, `disabled`(only range model), `merge`(only tooltipMerge is `true`)] |
| piecewise | Customize the piecewise slot. optional value: [`label`, `index`, `active`, `first`, `last`] |
| label | Customize the label slot. optional value: [`label`, `index`, `active`, `first`, `last`] |

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/dist/build.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions example/src/vue-slider/vue2-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@
@mousedown="moveStart($event, 0, true)"
@touchstart="moveStart($event, 0, true)"
>
<div ref="mergedTooltip" class="vue-merged-tooltip" :class="['vue-slider-tooltip-' + tooltipDirection[0], 'vue-slider-tooltip-wrap']" :style="tooltipMergedPosition">
<slot name="tooltip" :range="value">
<div
ref="mergedTooltip"
:class="['vue-merged-tooltip', 'vue-slider-tooltip-' + tooltipDirection[0], 'vue-slider-tooltip-wrap']"
:style="tooltipMergedPosition"
>
<slot name="tooltip" :value="val" :merge="true">
<span class="vue-slider-tooltip" :style="tooltipStyles">
{{ mergeFormatter ? mergeFormatting(val[0], val[1]) : (formatter ? (val[0] === val[1] ? formatting(val[0]) : `${formatting(val[0])} - ${formatting(val[1])}`) : (val[0] === val[1] ? val[0] : `${val[0]} - ${val[1]}`)) }}
</span>
Expand Down
8 changes: 6 additions & 2 deletions src/vue2-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@
@mousedown="moveStart($event, 0, true)"
@touchstart="moveStart($event, 0, true)"
>
<div ref="mergedTooltip" class="vue-merged-tooltip" :class="['vue-slider-tooltip-' + tooltipDirection[0], 'vue-slider-tooltip-wrap']" :style="tooltipMergedPosition">
<slot name="tooltip" :range="value">
<div
ref="mergedTooltip"
:class="['vue-merged-tooltip', 'vue-slider-tooltip-' + tooltipDirection[0], 'vue-slider-tooltip-wrap']"
:style="tooltipMergedPosition"
>
<slot name="tooltip" :value="val" :merge="true">
<span class="vue-slider-tooltip" :style="tooltipStyles">
{{ mergeFormatter ? mergeFormatting(val[0], val[1]) : (formatter ? (val[0] === val[1] ? formatting(val[0]) : `${formatting(val[0])} - ${formatting(val[1])}`) : (val[0] === val[1] ? val[0] : `${val[0]} - ${val[1]}`)) }}
</span>
Expand Down

0 comments on commit e08278b

Please sign in to comment.