From 7734f0cb5b9ee0b54d15ff6db0464d394172f909 Mon Sep 17 00:00:00 2001 From: halo <825251234@qq.com> Date: Wed, 5 Jan 2022 12:51:32 +0800 Subject: [PATCH] =?UTF-8?q?slider=20=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/docs/zh-CN/components/slider.md | 17 ++++++++++++++++- src/module/slider/index.vue | 12 +++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/example/docs/zh-CN/components/slider.md b/example/docs/zh-CN/components/slider.md index 1a20c0b0..39661b4e 100644 --- a/example/docs/zh-CN/components/slider.md +++ b/example/docs/zh-CN/components/slider.md @@ -53,7 +53,7 @@ export default { ::: demo ::: +::: title slider 属性 +::: + +::: table + +| 属性 | 描述 | 类型 | 可选值 | 默认值 | +| ------------ | --------------------- | ------------------------- | -------------- | -------- | +| v-model | 选中值 | `number` | - | - | +| vertical | 是否垂直 | `Boolean` | - | - | +| range | 是否区间 | `Boolean` | - | - | +| verticalrange | 垂直区间值 | `Array` | - | - | +| standardrange | 水平区间值 | `Array` | - | - | + +::: + ::: comment ::: diff --git a/src/module/slider/index.vue b/src/module/slider/index.vue index da4b98d2..805a264c 100644 --- a/src/module/slider/index.vue +++ b/src/module/slider/index.vue @@ -116,6 +116,7 @@ interface LaySliderProps { disabled?: boolean; range?: boolean; verticalrange?: number[]; + standardrange?: number[]; } const props = withDefaults(defineProps(), { @@ -124,11 +125,12 @@ const props = withDefaults(defineProps(), { disabled: false, }); -let rangeValue: Ref = ref([0, 0]); -if (Array.isArray(props.modelValue)) { - // eslint-disable-next-line vue/no-setup-props-destructure - rangeValue.value = props.modelValue; -} +// let rangeValue: Ref = ref([0, 0]); +let rangeValue: Ref | 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 | any = toRef(props, "verticalrange");