DemoSliderThumb.vue
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<script lang="ts" setup>
const satisfactionEmojis = ['😭', '😢', '☹️', '🙁', '😐', '🙂', '😊', '😁', '😄', '😍']
const slider = ref(45)
</script>
<template>
<VRow>
<VCol cols="12">
<div class="text-caption">
Show thumb when using slider
</div>
<VSlider
v-model="slider"
thumb-label
/>
</VCol>
<VCol cols="12">
<div class="text-caption">
Always show thumb label
</div>
<VSlider
v-model="slider"
thumb-label="always"
/>
</VCol>
<VCol cols="12">
<div class="text-caption">
Custom thumb size
</div>
<VSlider
v-model="slider"
:thumb-size="30"
thumb-label="always"
/>
</VCol>
<VCol cols="12">
<div class="text-caption">
Custom thumb label
</div>
<VSlider
v-model="slider"
thumb-label="always"
>
<template #thumb-label="{ modelValue }">
{{ satisfactionEmojis[Math.min(Math.floor(modelValue / 10), 9)] }}
</template>
</VSlider>
</VCol>
</VRow>
</template>