-
-
Notifications
You must be signed in to change notification settings - Fork 167
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: ✨ ToolTip 组件 offset 属性支持数组和对象写法 #625
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough本次变更涉及对 Tooltip 组件的 Changes
Possibly related PRs
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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: 1
Outside diff range and nitpick comments (3)
src/uni_modules/wot-design-uni/components/wd-tooltip/types.ts (1)
62-67
: 代码更改看起来不错,建议稍微调整注释这个更改很好地实现了PR的目标,允许
offset
属性接受更灵活的输入类型。代码逻辑正确,类型定义全面。建议更新属性注释以反映新的类型支持:
/** - * 出现位置的偏移量 - * 类型:number + * 出现位置的偏移量 + * 类型:number | [number, number] | { x: number, y: number } * 默认值:0 */docs/component/tooltip.md (1)
160-160
: 更新很好,但需要一些小改动
offset
属性的更新增加了灵活性,这是一个很好的改进。然而,有几点需要注意:
$LOWEST_VERSION$
占位符需要替换为实际的版本号。- 建议在文档中添加使用新输入类型的示例,以帮助用户理解如何使用数组和对象格式的 offset。
建议添加如下示例:
<!-- 使用数组格式 --> <wd-tooltip :offset="[10, 20]" content="使用数组偏移"> <wd-button>数组偏移</wd-button> </wd-tooltip> <!-- 使用对象格式 --> <wd-tooltip :offset="{ x: 15, y: 25 }" content="使用对象偏移"> <wd-button>对象偏移</wd-button> </wd-tooltip>Tools
Markdownlint
160-160: Expected: 6; Actual: 8; Too many cells, extra data will be missing
Table column count(MD056, table-column-count)
src/uni_modules/wot-design-uni/components/composables/usePopover.ts (1)
105-106
: 移除不必要的注释代码注释掉的旧代码可能会造成混淆,降低代码可读性。既然已经有新的实现,建议删除这些不再需要的注释代码。
建议删除以下代码:
- // const offsetX = (verticalX - 17 > 0 ? 0 : verticalX - 25) + offset - // const offsetY = (horizontalY - 17 > 0 ? 0 : horizontalY - 25) + offset
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- docs/component/tooltip.md (1 hunks)
- src/uni_modules/wot-design-uni/components/composables/usePopover.ts (3 hunks)
- src/uni_modules/wot-design-uni/components/wd-tooltip/types.ts (1 hunks)
Additional context used
Markdownlint
docs/component/tooltip.md
160-160: Expected: 6; Actual: 8; Too many cells, extra data will be missing
Table column count(MD056, table-column-count)
Additional comments not posted (2)
src/uni_modules/wot-design-uni/components/composables/usePopover.ts (2)
2-2
: 已正确导入isObj
函数引入了
isObj
函数,方便在后续代码中判断offset
是否为对象,增强了代码的健壮性。
80-80
: 请验证control
函数的所有调用是否已更新为新的offset
参数类型
control
函数的offset
参数类型已从number
扩展为number | number[] | Record<'x' | 'y', number>
。为了确保代码的稳定性,需要确认所有调用control
函数的地方都已适配新的参数类型,避免类型错误。运行以下脚本,查找所有对
control
函数的调用,并检查参数使用情况:
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
560
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit
offset
属性,支持多种类型(单个数字、数字数组或对象),并设定了默认值{x:0, y:0}
,增强了偏移配置的灵活性。