-
-
Notifications
You must be signed in to change notification settings - Fork 287
docs: 修复 Button/Icon/ConfigProvider/Popup 组件文档不一致问题 #1190
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
docs: 修复 Button/Icon/ConfigProvider/Popup 组件文档不一致问题 #1190
Conversation
- 修改 session-message-title 和 session-message-path 属性名称 - 新增 chooseavatar 和 agreeprivacyauthorization 事件回调
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for wot-design-uni ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Walkthrough本次更改涉及按钮组件、图标组件及配置提供者组件的文档更新。按钮组件文档中,重命名了两个与会话消息卡片相关的属性,并新增两个事件回调说明。图标组件文档中,调整了属性描述,新增点击事件说明,简化了图标使用说明,移除部分冗余内容。配置提供者组件文档中,完善了类型格式和安装说明,新增了 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 分钟 Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
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
🧹 Nitpick comments (2)
docs/component/button.md (1)
177-178
: 新增事件描述准确,表述与开放能力保持一致
chooseavatar
与agreeprivacyauthorization
事件已补充,参数说明完整,位置正确。建议后续考虑在「基本用法」或「示例」部分加入对应 demo,帮助读者快速理解触发方式。docs/en-US/component/button.md (1)
179-180
: New event rows added—consider wording polishEvents are correctly added, but the description “Get user avatar callback...” could be shortened to “Triggered after getting user avatar…” for conciseness. Optional copy-editing only; functionality is clear.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/component/button.md
(2 hunks)docs/en-US/component/button.md
(2 hunks)
🔇 Additional comments (2)
docs/component/button.md (1)
140-141
: 属性名已与官方保持一致,👍已将
session-message-*
更正为send-message-*
,与微信官方<button>
属性命名一致,无其它问题。请同步排查示例或其他文档中是否仍残留旧写法。docs/en-US/component/button.md (1)
140-141
: Attribute rename matches WeChat specReplacing
session-message-*
withsend-message-*
aligns with the official API. Looks good. Please ensure no remaining occurrences of the old names in other language docs or code examples.
- 调整属性描述,明确 name 属性可用于图标名称或图片链接 - 添加事件列表,明确 click 事件的参数 - 移除英文示例代码中不必要的示例和图标列表 - 优化文档结构和格式,使信息更加清晰
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
🧹 Nitpick comments (2)
docs/component/icon.md (2)
71-75
: 移除制表符并核对属性命名此行包含制表符,已被 markdownlint 报告为 MD010;建议改为纯空格以保持表格渲染一致性。
另外,属性表中的classPrefix
与示例中的class-prefix
命名风格不一致,最好统一(推荐使用示例中的 kebab-case)。-| name | 图标名称或图片链接 | string | - | - | - | +| name | 图标名称或图片链接 | string | - | - | - |
77-82
: 事件表描述完善,建议补充类型信息
click
事件的补充与组件实现及现有测试用例保持一致,👍
为了提高可读性,可在“参数”列中注明事件对象类型(如MouseEvent
)。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/component/icon.md
(1 hunks)docs/en-US/component/icon.md
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/en-US/component/icon.md
🧰 Additional context used
🧠 Learnings (1)
docs/component/icon.md (1)
Learnt from: Moonofweisheng
PR: #737
File: src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue:25-25
Timestamp: 2024-11-26T02:35:53.123Z
Learning: 在 wd-divider.vue
文件(路径:src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue
)中,props.customStyle
是字符串类型,用于传递自定义的样式字符串。
🪛 markdownlint-cli2 (0.17.2)
docs/component/icon.md
71-71: Hard tabs
Column: 21
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 8
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 27
(MD010, no-hard-tabs)
72-72: Hard tabs
Column: 31
(MD010, no-hard-tabs)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules - wot-design-uni
- GitHub Check: Header rules - wot-design-uni
- GitHub Check: Pages changed - wot-design-uni
- 调整文档中的强调样式,使用加粗替代下划线 - 完善英文文档缺失的内容,保持和中文文档一致
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 comments (1)
docs/en-US/component/config-provider.md (1)
111-116
:import
路径可能无法被解析
wot-design-uni
在大多数项目中以uni_modules
形式存在,直接从包根导入类型声明在 Vite/Ts 环境下未必生效。建议显式指向导出类型文件或通过@types/*
包提供的声明,避免 TS 找不到模块。-import type { ConfigProviderThemeVars } from 'wot-design-uni' +// 根据实际路径调整,示例: +import type { ConfigProviderThemeVars } from 'wot-design-uni/types'
🧹 Nitpick comments (4)
docs/en-US/component/config-provider.md (4)
206-213
: 建议为theme
与themeVars
提供默认值以避免空状态当前两者初始值为
undefined
,首次调用toggleTheme()
时会直接进入dark
分支,可能与用户预期不符;同时themeVars
为空时解构可能出现空引用。-const theme = ref<'light' | 'dark'>() -const themeVars = ref<ConfigProviderThemeVars>() +const theme = ref<'light' | 'dark'>('light') +const themeVars = ref<ConfigProviderThemeVars>({})
215-217
:toggleTheme
逻辑在初始未设置时直接切换到dark
,可能反直觉若用户从默认
light
期望“第一次点击切到 dark”,则应以light
为初始值而非undefined
;同时可简化分支。- theme.value = mode || (theme.value === 'light' ? 'dark' : 'light') + theme.value = mode ?? (theme.value === 'light' ? 'dark' : 'light')
219-224
: 补充返回类型以提升 IDE 提示显式声明返回对象类型,便于调用方获得完善的类型推导。
-export function useTheme(vars?: ConfigProviderThemeVars) { +export function useTheme( + vars?: ConfigProviderThemeVars +): { + theme: Ref<'light' | 'dark'> + themeVars: Ref<ConfigProviderThemeVars | undefined> + toggleTheme: (mode?: 'light' | 'dark') => void +} {
247-249
: 属性表默认值留空易引起歧义
theme
默认为light
,theme-vars
默认为空对象;建议在表格中标注,提升可读性。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/component/config-provider.md
(1 hunks)docs/en-US/component/config-provider.md
(4 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/component/config-provider.md
🧰 Additional context used
🧠 Learnings (1)
docs/en-US/component/config-provider.md (2)
Learnt from: Moonofweisheng
PR: #737
File: src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue:25-25
Timestamp: 2024-11-26T02:35:53.123Z
Learning: 在 wd-divider.vue
文件(路径:src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue
)中,props.customStyle
是字符串类型,用于传递自定义的样式字符串。
Learnt from: Moonofweisheng
PR: #733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue
中,由于 title
可能会发生变化,涉及到 title
的优化不太容易实现,需谨慎处理。
- 调整文档结构,优化标题层级 - 添加 v-model 使用示例,明确组件绑定值 - 移除冗余的代码示例,精简文档内容 - 更新属性表格,统一属性描述 - 添加防止滚动穿透的解决方案说明
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
🧹 Nitpick comments (1)
docs/en-US/component/popup.md (1)
70-83
: 示例文案与前述“detached”描述不一致
前文已将“teleport”表述统一为“detached”,但示例中的提示语仍写着 “I'm teleported to the root node”,易造成概念混淆。可适度修改示例文本保持一致性,例如:- <text class="custom-txt">I'm teleported to the root node</text> + <text class="custom-txt">I am detached to the root node</text>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/component/popup.md
(2 hunks)docs/en-US/component/popup.md
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/component/popup.md
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue` 中,由于 `title` 可能会发生变化,涉及到 `title` 的优化不太容易实现,需谨慎处理。
docs/en-US/component/popup.md (3)
Learnt from: Moonofweisheng
PR: #761
File: src/uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.vue:166-182
Timestamp: 2024-12-05T15:55:35.371Z
Learning: 在文件 wd-message-box.vue
的 toggleModal
方法中,当 isPass
为 false
时,应阻止执行 confirm
,但不触发 cancel
操作。
Learnt from: Moonofweisheng
PR: #737
File: src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue:25-25
Timestamp: 2024-11-26T02:35:53.123Z
Learning: 在 wd-divider.vue
文件(路径:src/uni_modules/wot-design-uni/components/wd-divider/wd-divider.vue
)中,props.customStyle
是字符串类型,用于传递自定义的样式字符串。
Learnt from: Moonofweisheng
PR: #733
File: src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue:327-327
Timestamp: 2024-11-24T06:12:44.418Z
Learning: 在 src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue
中,由于 title
可能会发生变化,涉及到 title
的优化不太容易实现,需谨慎处理。
🔇 Additional comments (1)
docs/en-US/component/popup.md (1)
130-139
: 事件列表可能遗漏open / opened
等常用生命周期事件
测试用例tests/components/wd-popup.test.ts
中曾断言open
相关事件,文档却未列出,容易让使用者以为不存在。请确认组件是否仍对外抛出open
、opened
(或同义事件),如存在应补充到表格中。
|Attribute|Description|Type|Optional Values|Default|Version| | ||
|---|---|---|---|---|---| | ||
|v-model|Whether to show popup|boolean|-|-|-| | ||
|position|Popup position|string|center/top/right/bottom/left|center|-| |
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.
🛠️ Refactor suggestion
“v-model” 表述有误,建议改为 model-value / v-model
并补充默认值
v-model
是语法糖而非真正的属性,组件实际接收的是 modelValue
(在模板中写作 model-value
)。当前表格既缺少这一说明,也未给出默认值。为避免读者误解,建议如下调整:
-|v-model|Whether to show popup|boolean|-|-|-|
+|model-value / v-model|Whether to show popup|boolean|-|false|-|
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
|Attribute|Description|Type|Optional Values|Default|Version| | |
|---|---|---|---|---|---| | |
|v-model|Whether to show popup|boolean|-|-|-| | |
|position|Popup position|string|center/top/right/bottom/left|center|-| | |
|Attribute|Description|Type|Optional Values|Default|Version| | |
|---|---|---|---|---|---| | |
|model-value / v-model|Whether to show popup|boolean|-|false|-| | |
|position|Popup position|string|center/top/right/bottom/left|center|-| |
🤖 Prompt for AI Agents
In docs/en-US/component/popup.md around lines 110 to 113, the attribute
"v-model" is incorrectly described as a direct prop; it should be updated to
"model-value / v-model" to clarify that "v-model" is syntax sugar for the actual
prop "modelValue" (used as "model-value" in templates). Also, add the default
value for this prop in the table. Modify the attribute name and description
accordingly to prevent reader confusion and include the default value.
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
系统性文档维护工作,修复多个组件文档中的不一致、错误和缺失问题。
💡 需求背景和解决方案
问题背景:
在对 Wot Design Uni 组件库进行系统性文档检查时,发现多个组件的文档存在以下问题:
本次修复涉及的组件:
解决方案详情:
1. Button 组件修复
问题:
修复:
session-message-title
→send-message-title
,session-message-path
→send-message-path
chooseavatar
、agreeprivacyauthorization
2. Icon 组件修复
问题:
修复:
click
事件说明custom
属性name
属性描述为"图标名称或图片链接"3. ConfigProvider 组件修复
问题:
修复:
<WdConfigProvider>
→<wd-config-provider>
4. Popup 组件修复
问题:
修复:
:visible.sync="show"
→v-model="show"
lockScroll
→lock-scroll
修改文件清单:
修改统计:
质量提升:
API 变更:
无 API 变更,所有修改都是为了让文档与组件实现保持一致。
验证方法:
☑️ 请求合并前的自查清单
Summary by CodeRabbit
Summary by CodeRabbit
session-message-title
→send-message-title
,session-message-path
→send-message-path
),补充chooseavatar
和agreeprivacyauthorization
事件文档custom
属性,修正自定义图标使用说明