Skip to content

Commit

Permalink
fix: 🐛 修复slider组件step属性无效问题
Browse files Browse the repository at this point in the history
Closes: #269
  • Loading branch information
jasper-ops authored and Moonofweisheng committed Apr 28, 2024
1 parent 9e7c8d3 commit 50133b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/component/slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ const value = ref<number[]>([10, 30])

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ watch(
watch(
() => props.step,
(newValue) => {
if (newValue <= 0) {
if (newValue < 1) {
stepValue.value = 1
console.warn('[wot design] warning(wd-slider): step must be greater than 0')
} else {
stepValue.value = Math.floor(newValue)
}
},
{ immediate: true }
Expand Down

0 comments on commit 50133b9

Please sign in to comment.