-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
fix: 🐛 修复直接使用title插槽不设置closeText时不显示title插槽内容,新增radius属性,header插槽 #760
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough此次更改主要集中在 Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for wot-design-uni ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
src/uni_modules/wot-design-uni/components/wd-number-keyboard/wd-number-keyboard.vue (1)
76-82
: 圆角样式实现可以优化当前实现方式正确,但建议添加单位验证以提高代码健壮性。
建议如下修改:
const rootStyle = computed(() => { const style: Record<string, string | number> = {} if (isDef(props.radius)) { + const radius = String(props.radius).includes('px') ? props.radius : `${props.radius}px` - style['border-radius'] = `${addUnit(props.radius)} ${addUnit(props.radius)} 0 0` + style['border-radius'] = `${radius} ${radius} 0 0` style['overflow'] = 'hidden' } return `${objToStyle(style)};` })docs/component/number-keyboard.md (1)
246-246
: header 插槽文档需要补充建议为 header 插槽添加更详细的说明和使用示例。
建议添加以下内容:
| name | 说明 | 类型 | 最低版本 | | ------ | ---- | ---- | -------- | | title | 标题 | - | 1.2.12 | -| header | 顶部 | - | | +| header | 顶部区域,可用于放置输入框等自定义内容 | - | 1.2.13 |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
docs/component/number-keyboard.md
(1 hunks)src/uni_modules/wot-design-uni/components/wd-number-keyboard/types.ts
(2 hunks)src/uni_modules/wot-design-uni/components/wd-number-keyboard/wd-number-keyboard.vue
(3 hunks)
🔇 Additional comments (4)
src/uni_modules/wot-design-uni/components/wd-number-keyboard/types.ts (1)
78-82
: 类型定义看起来不错!
radius
属性的类型定义正确,并且使用了 numericProp
来确保类型安全。
src/uni_modules/wot-design-uni/components/wd-number-keyboard/wd-number-keyboard.vue (3)
14-14
: 新增的 header 插槽实现正确
header 插槽的位置合理,可以让用户自定义键盘顶部的内容。
71-74
: 标题显示逻辑优化得当
通过 useSlots()
检查 title 插槽的存在性,修复了之前的问题。现在即使没有设置 closeText,title 插槽的内容也能正确显示。
Line range hint 89-98
: 随机数组打乱算法实现正确
使用 Fisher-Yates 洗牌算法来随机打乱数组,实现方式安全可靠。
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
在开发过程中,只设置title插槽的情况下,插槽不生效,由于判断条件只判断title值和closeText值导致该BUG,增加slots.title的判断解决该问题;某种情况下弹出框需要设置radius因此加入radius属性,解决某些产品UI弹出框的一致性;在使用组件过程中发现title插槽不满足需求,高度有限制,在实际使用过程中需要在NumberKeyboard顶部设置一些其他元素,例如输入框、用户基础信息等,因此加入header插槽,增加组件的拓展性。
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新特性
header
插槽。random-key-order
属性以增强安全性。extra-key
属性,支持多个额外键的数组形式。radius
属性以自定义背景圆角。文档
wd-number-keyboard
组件的文档,增加了新特性和使用示例。