-
Notifications
You must be signed in to change notification settings - Fork 76
fix: Number 类型支持分数形式的默认值配置
#742
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
|
@liweijie0812 帮忙看下 |
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 adds support for fraction-formatted default values (e.g., 210/332) for Number type properties. The change enables the Swiper component's cardScale API to accept a fraction as its default value while maintaining backward compatibility with standard numeric defaults.
Key changes:
- Enhanced type generation scripts to detect and preserve fraction-formatted default values for Number types
- Updated Swiper component props across Vue 2, Vue 3, and React to use the fraction format
210/332forcardScale
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/scripts/types/vue-props.js | Added regex pattern matching to detect fraction format and preserve it as-is for Number types |
| packages/scripts/types/react-default-props.js | Added similar fraction detection logic for React default props generation |
| packages/products/tdesign-vue/src/swiper/props.ts | Added default value 210/332 (evaluated as number) to cardScale prop |
| packages/products/tdesign-vue-next/packages/components/swiper/props.ts | Added default value 210/332 (evaluated as number) to cardScale prop |
| packages/products/tdesign-react/packages/components/swiper/defaultProps.ts | Changed cardScale from string '210/332' to evaluated number 210 / 332 |
Comments suppressed due to low confidence (1)
packages/scripts/types/react-default-props.js:1
- Corrected spacing in comment: '其它数字类型,按数值处理' should have a space after the comma: '其它数字类型, 按数值处理'.
/**
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/products/tdesign-react/packages/components/swiper/defaultProps.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>

在
Swiper组件内有一个 api 为cardScale类型为Number默认值为210/332