Files
heroui-vue/apps/docs/demos/slider-custom-output.vue

28 lines
682 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import {
Label,
Slider,
SliderOutput,
SliderTrack,
SliderFill,
SliderThumb,
} from "@heroui-vue/components";
</script>
<template>
<Slider class="w-full max-w-xs" :default-value="[25, 75]">
<Label>区间</Label>
<SliderOutput v-slot="{ values, getThumbValueLabel }">
{{ values.map((_, i) => getThumbValueLabel(i)).join(" – ") }}
</SliderOutput>
<SliderTrack v-slot="{ values }">
<SliderFill />
<SliderThumb
v-for="(_, index) in values"
:key="index"
:index="index"
:aria-label="index === 0 ? '区间下限' : '区间上限'"
/>
</SliderTrack>
</Slider>
</template>