Skip to content

Commit a37cee5

Browse files
committed
feat: style prop define
1 parent 8849dc9 commit a37cee5

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

playground/src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function handleAddData(value: number) {
5454
addable
5555
smooth
5656
show-stops
57+
size="large"
5758
:render-top="(data) => h('div', data.value)"
5859
@add="handleAddNumbers"
5960
/>
@@ -65,6 +66,7 @@ function handleAddData(value: number) {
6566
v-model="modelData"
6667
class="w-full pt16 pb8"
6768
addable
69+
size="large"
6870
:limit="5"
6971
:render-top="(data) => h('div', data.data)"
7072
:render-bottom="(data) => h('div', data.value)"

src/Range.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const props = withDefaults(defineProps<{
1616
deduplicate?: boolean
1717
rangeHighlight?: boolean
1818
showStops?: boolean | number
19+
size?: 'small' | 'medium' | 'large'
20+
thumb?: 'circle' | 'emptyCircle' | 'square' | 'emptySquare' | 'rect'
21+
thumbSize?: 'small' | 'medium' | 'large'
1922
renderTop?: RangeRenderFn<T>
2023
renderBottom?: RangeRenderFn<T>
2124
}>(), {
@@ -25,6 +28,9 @@ const props = withDefaults(defineProps<{
2528
step: 1,
2629
deduplicate: true,
2730
showStops: 12,
31+
size: 'small',
32+
thumb: 'circle',
33+
thumbSize: 'medium',
2834
})
2935
3036
const emits = defineEmits<{
@@ -194,7 +200,10 @@ provide(RangeContainerRefKey, containerRef)
194200
</script>
195201

196202
<template>
197-
<div ref="containerRef" class="the-range-container min-h-1 h8 box-content">
203+
<div
204+
ref="containerRef" class="the-range-container min-h-1 box-content"
205+
:class="{ small: 'h2', medium: 'h4', large: 'h8' }[size]"
206+
>
198207
<div
199208
ref="trackRef"
200209
class="the-range-track relative h-full bg-slate-3 select-none rd-4"
@@ -222,6 +231,8 @@ provide(RangeContainerRefKey, containerRef)
222231
:render-top="model[index].renderTop || renderTop"
223232
:render-bottom="model[index].renderBottom || renderBottom"
224233
:addable="addable"
234+
:thumb="thumb"
235+
:thumb-size="thumbSize"
225236
@move-done="current = -1"
226237
@update="onUpdate"
227238
@delete="onDelete"

src/RangeThumb.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const props = defineProps<{
1010
active?: boolean
1111
disabled?: boolean
1212
addable?: boolean
13+
thumb?: 'circle' | 'emptyCircle' | 'square' | 'emptySquare' | 'rect'
14+
thumbSize?: 'small' | 'medium' | 'large'
1315
renderTop?: RangeRenderFn<T>
1416
renderBottom?: RangeRenderFn<T>
1517
}>()

0 commit comments

Comments
 (0)