Skip to content

Commit 50133b9

Browse files
jasper-opsMoonofweisheng
authored andcommitted
fix: 🐛 修复slider组件step属性无效问题
Closes: #269
1 parent 9e7c8d3 commit 50133b9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/component/slider.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ const value = ref<number[]>([10, 30])
5656

5757
## Attributes
5858
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
59-
|-----|---------------------------|-----|-------|-------|--------|
59+
|-----|---------------------------|-----|-------|-------|-------|
6060
| v-model | 滑块值,如果为array,则为双向滑块 | number / array | - | - | - |
6161
| hide-min-max | 是否显示左右的最大最小值 | boolean | - | false | - |
6262
| hide-label | 是否显示当前滑块值 | boolean | - | false | - |
6363
| disabled | 是否禁用 | boolean | - | false | - |
6464
| max | 最大值 | number | - | 100 | - |
6565
| min | 最小值,允许负数`($LOWEST_VERSION$)` | number | - | 0 | - |
66-
| step | 步进值 | number | - | 1 | - |
66+
| step | 步进值 | number | - | 1 | `($LOWEST_VERSION$)` |
6767
| active-color | 进度条激活背景颜色 | string | - | linear-gradient(315deg, rgba(81,124,240,1) 0%,rgba(118,158,245,1) 100%) | - |
6868
| inactive-color | 进度条未激活背景颜色 | string | - | #e5e5e5 | - |
6969

src/uni_modules/wot-design-uni/components/wd-slider/wd-slider.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@ watch(
123123
watch(
124124
() => props.step,
125125
(newValue) => {
126-
if (newValue <= 0) {
126+
if (newValue < 1) {
127127
stepValue.value = 1
128128
console.warn('[wot design] warning(wd-slider): step must be greater than 0')
129+
} else {
130+
stepValue.value = Math.floor(newValue)
129131
}
130132
},
131133
{ immediate: true }

0 commit comments

Comments
 (0)