Skip to content

FmSlider 滑块

滑块组件,基于 Reka UI 的 Slider 组件封装,支持单选和多选。

基础用法

vue
<script setup lang="ts">
const value = ref<number[]>([0])
</script>

<template>
  <FmSlider v-model="value" />
</template>

垂直滑块

vue
<script setup lang="ts">
const value = ref<number[]>([0])
</script>

<template>
  <FmSlider v-model="value" orientation="vertical" />
</template>

API

Props

参数说明类型默认值
modelValue绑定值number[]-
defaultValue默认值number[][0]
disabled是否禁用booleanfalse
inverted是否反转booleanfalse
max最大值number100
min最小值number0
step步长number1
orientation朝向'horizontal' | 'vertical''horizontal'
thumbAlignment滑块对齐方式'contain' | 'cover''contain'
tooltip是否显示提示booleantrue

Events

事件名说明回调参数
update:modelValue值更新时触发(value: number[])

Slots

名称说明
-无插槽

示例

范围选择

vue
<script setup lang="ts">
const value = ref<number[]>([20, 60])
</script>

<template>
  <FmSlider v-model="value" :min="0" :max="100" />
</template>

自定义步长

vue
<script setup lang="ts">
const value = ref<number[]>([50])
</script>

<template>
  <FmSlider v-model="value" :step="10" :min="0" :max="100" />
</template>