Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Slider): button slot add dragging param #11946

Merged
merged 2 commits into from
Jun 11, 2023

Conversation

inottn
Copy link
Collaborator

@inottn inottn commented Jun 6, 2023

related #11943

if (typeof index === 'number') {
const slot = slots[index === 0 ? 'left-button' : 'right-button'];
let dragIndex;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单滑块模式下,dragIndex 设置为 0 也可以,这样就没有 undefined 的类型了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单滑块模式下其实不会返回 dragIndex 参数。
在双滑块模式下有个问题,用户可能需要知道当前是哪个滑块在被拖拽(只会在被拖拽的滑块上展示对应的信息)。
所以提供了 dragIndex 参数。如果当前没有拖拽行为,dragIndex 会返回 undefined。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok~ 要不加个单测用例

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

赞~

@chenjiahan chenjiahan merged commit 803292d into youzan:main Jun 11, 2023
@inottn inottn deleted the feat/slider-add-dragging-param branch October 14, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants