question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[comp: slider] add slider component

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

滑动型输入器,展示当前值和可选范围。

What does the proposed API look like?

Props

名称 说明 类型 默认值 全局配置 备注
v-model:value 绑定值 number | [number, number] 0 | [0, 0] - -
control 控件控制器 string | number | AbstractControl - - 配合 @idux/cdk/forms 使用, 参考 Form
disabled 设置禁用状态 boolean false - -
dots 显示间断点 boolean false - marks 间断点会始终显示
marks 刻度标记,key 的类型必须为 number 且取值在闭区间 [min, max] 内,每个标签可以单独设置样式 object - - { number: string | VNode } or { number: { style: object, label: string | VNode } } or { number: () => VNode }
keyboard 启用键盘行为 boolean true - -
max 最大值 number 100 - -
min 最小值 number 0 - -
range 设置范围选择模式 boolean false - 双滑块模式
reverse 设置反向坐标轴 boolean false - -
step 步长 number 1 - 要大于0
tooltipFormatter 格式化 tooltip 内容 (value: number) => VNode | string | number - - -
tooltipPlacement 设置 tooltip 显示位置 string auto - 参考 Tooltip
tooltipVisible 设置 tooltip 显示状态 boolean - - tooltip 默认为 hover 和拖拽时显示,tooltipVisible 设置为 true 则始终显示,反之则始终不显示
vertical 设置垂直状态 boolean false - -
onInput 拖动滑块时触发 (value: number) => void - - -
onChange Slider 的值改变后触发(mouseup 阶段触发) (value: number) => void - - -

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
danranVmcommented, Feb 26, 2021

@imguolao

  • 按照在 DIM 群里讨论的吧,保留 input 和 change 即可。
  • 去掉 ticksVisible ,新增 dotStop
  • 另外需要实现 control 的 props,参考 #153 ,和 input 组件。
1reaction
imguolaocommented, Feb 24, 2021
  1. 双滑块即可
  2. 假设我的 step 为 1, ticksVisible 为 true, 那你岂不是要显示100个刻度。。。还是不要吧。

如果设置了 step 为 1,然后范围为 [0, 100],那每次拖动只能拖 1 个长度,要拖 100 次才能拖到 max,没有人会这样用吧。 如果 step 为 1,然后范围为 [0, 10],拖 10 次就到 max,那么刻度也只有 0 到 10 之间的 9 个刻度,这个看使用者怎么想了。

我认为 ticksVisible 的意义不大,有 marks 配置就够了。 step = 0 时只允许拖拽到刻度上,或者新增一个 props 来控制仅允许拖拽到刻度上都行。

step 为 0 就没有刻度啦,marks 是标记,标记和刻度不一样。

  1. props 去掉 ticksVisible,slider 始终不显示刻度
  2. props 新增 dotStop,会有以下几种情况出现: a. 只设置了 step,那么滑动条会有隐藏的刻度,然后每次拖动只能拖到隐藏刻度上 b. 设置了 step 和 marks,那么滑动条会有隐藏的刻度,以及显示的 marks,然后每次拖动会拖到隐藏的刻度和显示的 marks 上 c. 只设置了 marks,那么滑动条会有显示的 marks,然后每次拖动只能拖到显示的 marks 上 d. 设置了 step 和 marks,然后 dotStop 为 true,那么滑动条会有显示的 marks,step 无效,平滑拖动
Read more comments on GitHub >

github_iconTop Results From Across the Web

Slider COMP | Derivative - TouchDesigner
The Slider Component lets you build sliders in X, Y and XY, and outputs 1 or 2 channels from a Panel CHOP placed...
Read more >
React Slider component - Material UI - MUI
Sliders allow users to make selections from a range of values. Sliders reflect a range of values along a bar, from which users...
Read more >
Slider Component - Maple Help - Maplesoft
The Slider component is customized by setting options in the Slider context panel. To view the Slider context panel, select the slider. Sliders...
Read more >
How to use Slider Component in Material UI ? - GeeksforGeeks
Sliders allow users to make selections from a range of values. · Creating React Application And Installing Module: · Step 1: Create a...
Read more >
How to make a simple slider component in React
However, while this may fulfill the slider component necessity there are a few things that limit it. We should add some styling and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found