-
Notifications
You must be signed in to change notification settings - Fork 581
fix(Slider): precision when init #6183
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
Conversation
TDesign Component Site Preview Open
|
commit: |
dd6d296 to
0bf0d73
Compare
0bf0d73 to
28e12ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a precision calculation issue in the Slider component during initialization. The main change involves moving utility functions to a common package and applying precision formatting when initializing slider values.
Key Changes:
- Extracted slider utility functions (
formatPrecision,formatSliderValue,getStopStyle,formatLabel) from local utils to@tdesign/common-js/slider/utils - Applied
formatPrecisionto initial value calculations in both range and single-value slider modes - Updated imports across slider-related files to use the centralized utilities
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/components/slider/utils/index.ts | Removed local utility functions (moved to common package) |
| packages/components/slider/slider.tsx | Applied precision formatting to initial values and updated imports |
| packages/components/slider/slider-button.tsx | Replaced manual precision formatting with formatPrecision utility |
| packages/components/slider/hooks/useSliderTooltip.tsx | Updated imports to use common utilities |
| packages/components/slider/hooks/useSliderMark.tsx | Updated imports to use common utilities |
| packages/components/slider/tests/base.test.tsx | Updated test imports to reference common utilities |
| packages/components/divider/tests/snapshots/divider.test.tsx.snap | Unrelated snapshot removal |
| packages/common | Subproject commit update to include new shared utilities |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/components/divider/__tests__/__snapshots__/divider.test.tsx.snap
Show resolved
Hide resolved
|
/update-common |

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
截图来源:
demo -> swiper/card「原先」

「修复后」

📝 更新日志
tdesign-vue-next
@tdesign-vue-next/chat
@tdesign-vue-next/auto-import-resolver
☑️ 请求合并前的自查清单