feat: ✨ 重构 Curtain 优化控制展示隐藏的实现逻辑#895
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough本次改动主要涉及
Changes
Sequence Diagram(s)sequenceDiagram
participant Parent
participant CurtainComponent
Parent->>CurtainComponent: 传入 modelValue(初始状态)
CurtainComponent-->>Parent: emit update:modelValue(状态变更)
Parent->>CurtainComponent: 更新后的 modelValue(同步状态)
Poem
✨ Finishing Touches
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!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying wot-design-uni with
|
| Latest commit: |
f6c90b3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://42e97184.wot-design-uni.pages.dev |
| Branch Preview URL: | https://refactor-curtain-v-model.wot-design-uni.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/uni_modules/wot-design-uni/components/wd-curtain/types.ts (1)
19-25: 代码变更符合 Vue 最佳实践!通过引入
modelValue并将value标记为已弃用,代码遵循了 Vue 的v-model约定。建议在modelValue的文档注释中添加一个示例,展示如何使用v-model绑定。/** * 绑定值,展示/关闭幕帘 */ -modelValue: makeBooleanProp(false), +/** + * 绑定值,展示/关闭幕帘 + * @example + * <wd-curtain v-model="isVisible" /> + */ +modelValue: makeBooleanProp(false),docs/component/curtain.md (1)
87-90: 建议添加迁移指南!文档已经清晰地标明了
value属性的废弃状态,建议添加一个迁移指南部分,帮助用户从value迁移到v-model。| value | 绑定值,展示/关闭幕帘(已废弃,请使用 modelValue) | boolean | - | - | - | | modelValue | 绑定值,展示/关闭幕帘 | boolean | - | - | $LOWEST_VERSION$ | + +## 从 value 迁移到 v-model + +为了提供更好的开发体验,我们推荐使用 `v-model` 来控制幕帘的显示状态: + +```diff +- <wd-curtain :value="isVisible" @close="isVisible = false" /> ++ <wd-curtain v-model="isVisible" /> +```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/component/curtain.md(5 hunks)src/pages/curtain/Index.vue(1 hunks)src/uni_modules/wot-design-uni/components/wd-curtain/types.ts(2 hunks)src/uni_modules/wot-design-uni/components/wd-curtain/wd-curtain.vue(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Redirect rules - wot-design-uni
- GitHub Check: Header rules - wot-design-uni
- GitHub Check: Pages changed - wot-design-uni
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
src/pages/curtain/Index.vue (1)
26-34: 代码简化提升了可维护性!使用
v-model替代手动的关闭事件处理,大大简化了代码结构,减少了重复代码,提高了可维护性。src/uni_modules/wot-design-uni/components/wd-curtain/wd-curtain.vue (2)
66-67: 事件声明完整且符合规范!新增
update:modelValue事件支持v-model双向绑定。
70-88: 状态管理逻辑清晰且兼容性好!
- 使用
modelValue作为主要状态,同时保持对value的向后兼容- 通过 watch 确保状态同步和双向绑定
🤔 这个 PR 的性质是?(至少选择一个)
🔗 相关 Issue
💡 需求背景和解决方案
重构 Curtain 优化控制展示隐藏的实现逻辑
☑️ 请求合并前的自查清单
Summary by CodeRabbit
Documentation
Refactor