fix: 🐛 修复popover tooltip组件visibleArrow=false时弹出框距离元素间距过远的问题#792
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
概述遍历
变更
对链接问题的评估
可能相关的 PR
建议的审阅者
诗歌
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/uni_modules/wot-design-uni/components/composables/usePopover.ts (1)
83-83: 箭头大小计算逻辑正确,建议提取为常量为提高代码可维护性,建议将箭头尺寸提取为命名常量。
+const ARROW_SIZE = 9 +const NO_ARROW_SIZE = 0 -const arrowSize = visibleArrow ? 9 : 0 +const arrowSize = visibleArrow ? ARROW_SIZE : NO_ARROW_SIZEsrc/uni_modules/wot-design-uni/components/wd-tooltip/wd-tooltip.vue (1)
48-48: 建议添加 visibleArrow 属性值验证为了提高组件的健壮性,建议在 watch 中添加对 visibleArrow 的类型检查。
+watch( + () => props.visibleArrow, + (newVal) => { + if (typeof newVal !== 'boolean') { + console.warn('[wot-design] warning(wd-tooltip): visibleArrow must be a boolean value') + } + }, + { immediate: true } +)src/uni_modules/wot-design-uni/components/wd-popover/wd-popover.vue (1)
79-79: 建议保持与 tooltip 组件一致的属性验证为保持组件库的一致性,建议添加与 tooltip 组件相同的 visibleArrow 属性值验证。
+watch( + () => props.visibleArrow, + (newVal) => { + if (typeof newVal !== 'boolean') { + console.warn('[wot-design] warning(wd-popover): visibleArrow must be a boolean value') + } + }, + { immediate: true } +)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/uni_modules/wot-design-uni/components/composables/usePopover.ts(2 hunks)src/uni_modules/wot-design-uni/components/wd-popover/wd-popover.vue(1 hunks)src/uni_modules/wot-design-uni/components/wd-tooltip/wd-tooltip.vue(1 hunks)
🔇 Additional comments (1)
src/uni_modules/wot-design-uni/components/composables/usePopover.ts (1)
4-4: 函数签名修改合理!
通过添加默认值为 true 的 visibleArrow 参数,保持了向后兼容性,同时支持了新的箭头隐藏功能。
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
close #788
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
错误修复
改进