File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ function handleAddThumbData(value: number) {
3232 <Range
3333 v-model =" modelSingle"
3434 class =" w-full pt16 pb8"
35+ :min =" 0"
36+ :max =" 10"
3537 />
3638 <h2 >number[]</h2 >
3739 range-highlight
@@ -43,14 +45,15 @@ function handleAddThumbData(value: number) {
4345 range-highlight
4446 />
4547 <h2 >number[]</h2 >
46- add smooth
48+ add smooth show-stops
4749 <br >
4850 {{ modelNumbersAdd }}
4951 <Range
5052 v-model =" modelNumbersAdd"
5153 class =" w-full pt16 pb8"
5254 add
5355 smooth
56+ show-stops
5457 :render-top =" (data) => h('div', data.value)"
5558 @add-thumb =" handleAddThumbNumbers"
5659 />
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const props = withDefaults(defineProps<{
1515 smooth? : boolean
1616 deduplicate? : boolean
1717 rangeHighlight? : boolean
18+ showStops? : boolean | number
1819 renderTop? : RangeRenderFn <T >
1920 renderBottom? : RangeRenderFn <T >
2021}>(), {
@@ -62,6 +63,15 @@ const allowAdd = computed(() =>
6263 && (! props .limit || model .value .length < props .limit )
6364 && modelType .value !== ' single' ,
6465)
66+ const stops = computed (() => {
67+ const stops = Math .floor ((props .max - props .min ) / props .step ) + 1
68+ if (props .showStops === true )
69+ return stops
70+ else if (typeof props .showStops === ' number' )
71+ return stops > props .showStops ? - 1 : stops
72+ else
73+ return stops > 12 ? - 1 : stops
74+ })
6575
6676const indexMap = ref <number []>([])
6777function sort(val : RangeData <T >[]) {
@@ -198,6 +208,9 @@ provide(RangeContainerRefKey, containerRef)
198208 :style =" { left: `${Math.min(...position)}%`, right: `${100 - Math.max(...position)}%` }"
199209 />
200210 </div >
211+ <div v-if =" stops > 0" class =" the-range-points absolute h-full rd-full left--3px right--3px rd-3px flex justify-between items-center overflow-hidden" >
212+ <div v-for =" index in stops" :key =" index" class =" w-6px h-6px rd-3px op50 bg-white" />
213+ </div >
201214 <RangeThumb
202215 v-for =" index, idx in indexMap"
203216 :key =" idx"
You can’t perform that action at this time.
0 commit comments