slider 文档

This commit is contained in:
halo 2022-01-05 12:51:32 +08:00
parent ada270da87
commit 7734f0cb5b
2 changed files with 23 additions and 6 deletions

View File

@ -53,7 +53,7 @@ export default {
::: demo
<template>
<lay-slider v-model="value3" :range="true"></lay-slider>
<lay-slider v-model:standardrange="value3" :range="true"></lay-slider>
</template>
<script>
@ -91,5 +91,20 @@ export default {
</script>
:::
::: title slider 属性
:::
::: table
| 属性 | 描述 | 类型 | 可选值 | 默认值 |
| ------------ | --------------------- | ------------------------- | -------------- | -------- |
| v-model | 选中值 | `number` | - | - |
| vertical | 是否垂直 | `Boolean` | - | - |
| range | 是否区间 | `Boolean` | - | - |
| verticalrange | 垂直区间值 | `Array` | - | - |
| standardrange | 水平区间值 | `Array` | - | - |
:::
::: comment
:::

View File

@ -116,6 +116,7 @@ interface LaySliderProps {
disabled?: boolean;
range?: boolean;
verticalrange?: number[];
standardrange?: number[];
}
const props = withDefaults(defineProps<LaySliderProps>(), {
@ -124,11 +125,12 @@ const props = withDefaults(defineProps<LaySliderProps>(), {
disabled: false,
});
let rangeValue: Ref<number[]> = ref([0, 0]);
if (Array.isArray(props.modelValue)) {
// eslint-disable-next-line vue/no-setup-props-destructure
rangeValue.value = props.modelValue;
}
// let rangeValue: Ref<number[]> = ref([0, 0]);
let rangeValue: Ref<number[]> | any = toRef(props, "standardrange");
// if (Array.isArray(props.modelValue)) {
// // eslint-disable-next-line vue/no-setup-props-destructure
// rangeValue.value = props.modelValue;
// }
let verticalRangeValue: Ref<number[]> | any = toRef(props, "verticalrange");