Skip to content

feat(dialog): 优化全屏交互体验,实现全屏状态可控,并增大全屏按钮热区#660

Merged
kanyxmo merged 2 commits into
mineadmin:masterfrom
TAYUN:fix/fullscreen-change
Jul 24, 2025
Merged

feat(dialog): 优化全屏交互体验,实现全屏状态可控,并增大全屏按钮热区#660
kanyxmo merged 2 commits into
mineadmin:masterfrom
TAYUN:fix/fullscreen-change

Conversation

@TAYUN

@TAYUN TAYUN commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

优化内容:

  • 将全屏状态从本地 ref 变量转换为 defineModel 实现双向绑定
  • 将点击事件处理从 SVG 图标移至父级 el-link 元素
  • 通过向父组件暴露全屏状态提高组件可复用性
  • 扩大全屏切换的点击区域,提升用户体验

对比

全屏状态管理改进:

旧代码:使用本地 ref 变量 fullscreen 管理全屏状态
新代码:使用 defineModel<boolean>('fullscreen', { default: false }) 将全屏状态暴露为可双向绑定的 prop,使父组件可以控制和响应对话框的全屏状态

点击事件处理优化:

旧代码:全屏切换点击事件绑定在 SVG 图标上 @click="() => fullscreen = !fullscreen"
新代码:点击事件移到了父元素 el-link 上,使点击区域更大,提高了用户体验

这些变更主要提高了组件的可复用性和灵活性,通过将全屏状态作为可双向绑定的 model 暴露出来,使父组件能够更好地控制对话框的行为。同时,点击区域的优化也提升了用户体验。

优化前:

default.mp4

优化后

default.mp4

Summary by CodeRabbit

  • 新功能

    • 对弹窗组件的全屏模式支持外部 v-model 控制,也可内部自管理,提升灵活性和一致性。
  • 重构

    • 优化全屏状态管理,统一受控与非受控场景的处理方式。

- 实现了对话框的全屏和非全屏状态切换
- 支持 v-model 受控
- 优化全屏切换按钮交互体检
@boring-cyborg

boring-cyborg Bot commented Jul 23, 2025

Copy link
Copy Markdown

Thanks for opening this pull request! Please check out our contributing guidelines. 感谢您开启此拉取请求!请查看我们的 贡献者指南

@coderabbitai

coderabbitai Bot commented Jul 23, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

对话框组件的全屏状态由内部响应式布尔值改为使用defineModel定义的fullscreen v-model prop,实现外部可控。全屏切换的点击事件从图标移至外层el-link元素,图标显示根据全屏状态切换。

Changes

文件/路径 变更摘要
web/src/components/ma-dialog/index.vue 将全屏状态改为defineModel绑定的v-model prop,调整全屏切换事件绑定位置和图标显示逻辑

Estimated code review effort

1 (~5分钟)

Poem

兔子轻点代码键,
全屏切换新篇篇。
绑定模型真方便,
点击事件换新边。
界面灵动又欢颜,
兔儿欢跃庆更新! 🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2fba66 and f456f36.

📒 Files selected for processing (1)
  • web/src/components/ma-dialog/index.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/components/ma-dialog/index.vue

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 or PR title anywhere in the PR title to generate the title automatically.

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.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement labels Jul 23, 2025

@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: 3

🔭 Outside diff range comments (1)
web/src/components/ma-dialog/index.vue (1)

106-106: 模板绑定需要更新为统一状态

模板中仍然绑定的是 fullscreen 而不是统一的 isFullscreen 计算属性,这使得重构不完整,对话框的实际全屏状态不会反映统一的状态管理逻辑。

需要修改为:

-    :fullscreen="fullscreen"
+    :fullscreen="isFullscreen"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c57753e and b2fba66.

📒 Files selected for processing (1)
  • web/src/components/ma-dialog/index.vue (2 hunks)
🔇 Additional comments (2)
web/src/components/ma-dialog/index.vue (2)

54-55: v-model 声明正确

fullscreen 的 v-model 声明语法正确,默认值设置为 false 是合理的。


123-128: 模板优化很好,增强了用户体验

使用 el-link 包装全屏图标是很好的改进:

  • 增大了点击热区,提升移动端体验
  • 保持了原有的视觉效果
  • 正确使用了 isFullscreen 进行状态切换和图标显示

注意:这部分代码的正确性依赖于修复 isFullscreen 计算属性的相关问题。

Comment thread web/src/components/ma-dialog/index.vue Outdated
Comment thread web/src/components/ma-dialog/index.vue Outdated
Comment thread web/src/components/ma-dialog/index.vue Outdated
@TAYUN TAYUN closed this Jul 23, 2025
@TAYUN TAYUN reopened this Jul 23, 2025
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 23, 2025
- 将全屏状态从本地 ref 变量转换为 defineModel 实现双向绑定
- 将点击事件处理从 SVG 图标移至父级 el-link 元素
- 通过向父组件暴露全屏状态提高组件可复用性
- 扩大全屏切换的点击区域,提升用户体验
@TAYUN TAYUN changed the title feat(dialog): 优化对话框全屏切换功能,支持受控和非受控模式,并增大全屏按钮热区 feat(dialog): 优化全屏交互体验,实现全屏状态可控,并增大全屏按钮热区 Jul 23, 2025
@zds-s
zds-s requested review from Copilot, kanyxmo and people-sea July 23, 2025 04:13

Copilot AI 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.

Pull Request Overview

This PR optimizes the fullscreen interaction experience in a dialog component by making the fullscreen state controllable and expanding the clickable area of the fullscreen button. The changes improve component reusability by exposing the fullscreen state as a two-way bindable model property and enhance user experience by moving the click handler to a larger parent element.

  • Convert local fullscreen ref to a defineModel for two-way binding
  • Move click event handler from SVG icon to parent el-link element
  • Expand the clickable area for better user interaction

@people-sea people-sea left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅LGTM

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 23, 2025
@kanyxmo
kanyxmo merged commit ba5816a into mineadmin:master Jul 24, 2025
37 checks passed
@boring-cyborg

boring-cyborg Bot commented Jul 24, 2025

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! 祝贺你的第一个拉取请求被合并!

@coderabbitai coderabbitai Bot mentioned this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants