Skip to content

fix: 🐛 修复 Overlay 组件锁定背景滚动属性 lock-scroll 无法取消的问题 - #1149

Merged
Moonofweisheng merged 1 commit into
masterfrom
fix/overlay-lockscroll
Jul 6, 2025
Merged

fix: 🐛 修复 Overlay 组件锁定背景滚动属性 lock-scroll 无法取消的问题#1149
Moonofweisheng merged 1 commit into
masterfrom
fix/overlay-lockscroll

Conversation

@Moonofweisheng

@Moonofweisheng Moonofweisheng commented Jul 5, 2025

Copy link
Copy Markdown
Owner

🤔 这个 PR 的性质是?(至少选择一个)

  • 日常 bug 修复
  • 新特性提交
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • CI/CD 改进
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 代码重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

💡 需求背景和解决方案

当前overlay组件lock-scroll的实现会导致锁定遮罩滚动的配置无法取消

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Summary by CodeRabbit

  • 新功能

    • wd-transition 组件新增 disable-touch-move 属性,可控制是否阻止触摸滚动,默认值为 false
    • 文档补充并详细列出 TransitionName 动画类型及说明。
  • 文档

    • 优化并补充 overlay 组件中 lockScroll 属性说明,更明确其行为。
    • wd-transition 组件文档重构属性表,完善描述,并增加动画类型枚举说明。
    • 英文文档同步更新,提升一致性与可读性。
  • 样式与示例

    • 覆盖层示例页面支持切换 lockScroll,并优化内容结构与滚动体验。

@netlify

netlify Bot commented Jul 5, 2025

Copy link
Copy Markdown

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit 1454ce2
🔍 Latest deploy log https://app.netlify.com/projects/wot-design-uni/deploys/6868d35d89104a00081d5095
😎 Deploy Preview https://deploy-preview-1149--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 5, 2025

Copy link
Copy Markdown

Walkthrough

本次更新主要聚焦于 overlay 和 transition 组件及其文档。overlay 组件增加了对 lockScroll 的演示和说明,transition 组件新增了 disable-touch-move 属性,并完善了动画类型定义和文档说明。相关组件源码、类型定义和中英文文档均做了相应调整。

Changes

文件/路径分组 变更摘要
docs/component/overlay.md 明确 lockScroll 属性描述,补充其锁定背景及内部滚动的说明。
docs/component/transition.md
docs/en-US/component/transition.md
重写属性表,新增 disable-touch-move 属性,动画类型独立为 TransitionName 枚举,完善表述与结构。
src/subPages/overlay/Index.vue 增加 lockScroll 响应式变量,展示切换锁定滚动的 UI,优化样式与内容结构。
src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue 移除手动 touchmove 事件处理,改为通过 disable-touch-move 属性控制。
src/uni_modules/wot-design-uni/components/wd-transition/types.ts transitionProps 新增 disableTouchMove:boolean 属性,默认 false。
src/uni_modules/wot-design-uni/components/wd-transition/wd-transition.vue 根据 disableTouchMove 拆分渲染分支,新增 isShow 计算属性和 noop 方法,分别处理 touchmove 事件。

Sequence Diagram(s)

sequenceDiagram
    participant 用户
    participant OverlayDemo(Index.vue)
    participant wd-overlay
    participant wd-transition

    用户->>OverlayDemo(Index.vue): 切换 lockScroll 开关
    OverlayDemo(Index.vue)->>wd-overlay: 传递 lockScroll 属性
    wd-overlay->>wd-transition: 传递 disable-touch-move 属性
    wd-transition-->>wd-transition: 根据 disableTouchMove 渲染不同分支
    用户->>wd-transition: 触发 touchmove
    alt disableTouchMove 为 true
        wd-transition->>wd-transition: noop 阻止滚动
    else disableTouchMove 为 false
        wd-transition->>wd-transition: 不阻止滚动
    end
Loading

Poem

🐇
叠影轻舞锁滚动,
新增属性巧无穷。
动画类型表中列,
触摸滑动随手控。
文档焕新如春风,
代码世界更从容。

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel

vercel Bot commented Jul 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2025 7:25am

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.20%. Comparing base (ed923ec) to head (1454ce2).

Files with missing lines Patch % Lines
...ign-uni/components/wd-transition/wd-transition.vue 78.57% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1149      +/-   ##
==========================================
- Coverage   85.29%   83.20%   -2.09%     
==========================================
  Files         216        5     -211     
  Lines       17337      268   -17069     
  Branches     2779       49    -2730     
==========================================
- Hits        14787      223   -14564     
+ Misses       2550       45    -2505     
Flag Coverage Δ
h5 83.20% <82.35%> (-2.09%) ⬇️
wd-action-sheet ?
wd-backtop ?
wd-badge ?
wd-button ?
wd-calendar ?
wd-calendar-view ?
wd-card ?
wd-cell ?
wd-cell-group ?
wd-checkbox ?
wd-checkbox-group ?
wd-circle ?
wd-col-picker ?
wd-collapse ?
wd-config-provider ?
wd-count-down ?
wd-count-to ?
wd-curtain ?
wd-datetime-picker ?
wd-datetime-picker-view ?
wd-divider ?
wd-drop-menu ?
wd-fab ?
wd-floating-panel ?
wd-form ?
wd-gap ?
wd-grid ?
wd-grid-item ?
wd-icon ?
wd-img ?
wd-img-cropper ?
wd-index-anchor ?
wd-index-bar ?
wd-input ?
wd-input-number ?
wd-keyboard ?
wd-layout ?
wd-loading ?
wd-loadmore ?
wd-message-box ?
wd-navbar ?
wd-navbar-capsule ?
wd-notice-bar ?
wd-notify ?
wd-number-keyboard ?
wd-overlay 90.00% <100.00%> (+1.26%) ⬆️
wd-pagination ?
wd-password-input ?
wd-picker ?
wd-picker-view ?
wd-popover ?
wd-popup ?
wd-progress ?
wd-radio ?
wd-radio-group ?
wd-rate ?
wd-resize ?
wd-search ?
wd-segmented ?
wd-select-picker ?
wd-sidebar ?
wd-signature ?
wd-skeleton ?
wd-slider ?
wd-sort-button ?
wd-status-tip ?
wd-step ?
wd-steps ?
wd-sticky ?
wd-sticky-box ?
wd-swipe-action ?
wd-swiper ?
wd-swiper-nav ?
wd-switch ?
wd-tabbar ?
wd-table ?
wd-tabs ?
wd-tag ?
wd-text ?
wd-textarea ?
wd-toast ?
wd-tooltip ?
wd-transition 80.80% <81.25%> (-0.18%) ⬇️
wd-upload ?
wd-video-preview ?
wd-watermark ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 5, 2025

Copy link
Copy Markdown

组件测试摘要 (H5 平台)

测试时间: Sat Jul 5 07:27:04 UTC 2025

测试结果

组件 状态 覆盖率
wd-overlay ✅ 通过 90%
wd-transition ✅ 通过 80.8%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed923ec and 1454ce2.

📒 Files selected for processing (7)
  • docs/component/overlay.md (1 hunks)
  • docs/component/transition.md (1 hunks)
  • docs/en-US/component/transition.md (1 hunks)
  • src/subPages/overlay/Index.vue (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue (1 hunks)
  • src/uni_modules/wot-design-uni/components/wd-transition/types.ts (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-transition/wd-transition.vue (3 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#534
File: docs/component/form.md:44-44
Timestamp: 2024-08-19T13:43:36.518Z
Learning: Moonofweisheng prefers addressing syntax errors such as missing quotation marks in the code.
docs/component/overlay.md (1)
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#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` 是字符串类型,用于传递自定义的样式字符串。
src/uni_modules/wot-design-uni/components/wd-transition/types.ts (3)
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#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: 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` 的优化不太容易实现,需谨慎处理。
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#748
File: src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue:87-128
Timestamp: 2024-11-30T06:44:18.181Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue` 文件中,当 `percentage` 为 0 时,应通过 `update` 函数处理 `percentage` 为 0 的情况,而不需要在 `updateProgress` 函数中进行特殊处理。
src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue (2)
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` 的优化不太容易实现,需谨慎处理。
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#748
File: src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue:87-128
Timestamp: 2024-11-30T06:44:18.181Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue` 文件中,当 `percentage` 为 0 时,应通过 `update` 函数处理 `percentage` 为 0 的情况,而不需要在 `updateProgress` 函数中进行特殊处理。
src/subPages/overlay/Index.vue (2)
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` 的优化不太容易实现,需谨慎处理。
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#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` 操作。
src/uni_modules/wot-design-uni/components/wd-transition/wd-transition.vue (3)
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` 的优化不太容易实现,需谨慎处理。
Learnt from: Moonofweisheng
PR: Moonofweisheng/wot-design-uni#748
File: src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue:87-128
Timestamp: 2024-11-30T06:44:18.181Z
Learning: 在 `src/uni_modules/wot-design-uni/components/wd-progress/wd-progress.vue` 文件中,当 `percentage` 为 0 时,应通过 `update` 函数处理 `percentage` 为 0 的情况,而不需要在 `updateProgress` 函数中进行特殊处理。
Learnt from: chen-ziwen
PR: Moonofweisheng/wot-design-uni#909
File: src/uni_modules/wot-design-uni/components/wd-input-number/wd-input-number.vue:276-281
Timestamp: 2025-02-20T05:57:28.165Z
Learning: In Vue components, cleanup of one-time timers (setTimeout) during component unmount is optional as they will be automatically cleaned up by the garbage collector. Prefer simpler code unless explicit cleanup is necessary.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test Components (wd-overlay)
  • GitHub Check: Test Components (wd-transition)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (12)
src/uni_modules/wot-design-uni/components/wd-transition/types.ts (1)

98-104: 新增属性定义符合代码规范!

新增的 disableTouchMove 属性定义完整且规范:

  • 使用了标准的 JSDoc 注释格式
  • 类型定义正确,默认值合理
  • 命名清晰,描述准确
  • 与现有代码风格保持一致
docs/component/overlay.md (1)

48-48: 文档更新准确且有帮助!

更新后的描述清楚地说明了 lockScroll 属性的完整行为,包括对蒙层内容滚动的影响。这有助于开发者正确理解和使用该功能。

src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue (1)

8-8: 重构改进了代码结构!

使用 :disable-touch-move="lockScroll" 替换手动事件处理是一个很好的改进:

  • 将触摸处理逻辑统一到 wd-transition 组件中
  • 代码更简洁,避免了重复的事件处理代码
  • 提高了代码的可维护性和一致性
src/subPages/overlay/Index.vue (3)

15-26: 演示示例设计优秀!

新增的演示很好地展示了 lockScroll 功能:

  • 提供了开关控制,用户可以实时切换功能状态
  • 包含了可滚动内容,直观展示锁定效果
  • 使用 @click.stop="" 防止事件冒泡,避免误触关闭

34-34: 响应式状态定义正确!

lockScroll 初始值设置为 true 是合理的,符合常见的使用场景。


39-62: 样式设计合理且实用!

样式更新支持了新的布局需求:

  • 使用 flexbox 布局,结构清晰
  • 添加了 .content 样式,提供良好的视觉效果
  • .scroll 容器设置了固定高度和垂直滚动,便于演示
  • .block 样式适应了新的布局需求
docs/en-US/component/transition.md (2)

75-84: 文档更新完整且专业!

属性表格的更新很好地补充了新功能的说明:

  • 新增的 disable-touch-move 属性文档清晰
  • 表格格式规范,信息完整
  • 描述准确,有助于开发者理解功能

85-99: TransitionName 类型说明有价值!

新增的动画类型详细说明提供了很大的价值:

  • 列出了所有可用的动画类型
  • 每个类型都有清晰的描述
  • 格式规范,便于查阅
docs/component/transition.md (2)

77-84: 文档更新完善,格式清晰!

新增的 disable-touch-move 属性文档化完善,表格格式对齐良好,属性描述清晰准确。


85-100: TransitionName 枚举文档化很有价值!

新增的 TransitionName 枚举说明表格为开发者提供了清晰的动画类型参考,有助于提高开发体验。

src/uni_modules/wot-design-uni/components/wd-transition/wd-transition.vue (2)

95-97: computed 属性重构提升了代码可读性!

将模板中的内联条件 !lazyRender || inited 提取为 isShow 计算属性,使模板更加清晰易读。


228-228: noop 函数实现简洁恰当!

noop 函数作为空函数用于阻止 touchmove 事件,实现简洁且符合预期用途。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants