- Notifications
You must be signed in to change notification settings - Fork 8.3k
fix: 混合双列 onMounted 关闭二级侧边栏 #6807
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
Conversation
|
WalkthroughExpanded the auto-collapse trigger to run when the app layout is either header-mixed-nav or sidebar-mixed-nav by replacing a strict equality check with an inclusion check. No other logic, structure, or public APIs were modified. Changes
Sequence Diagram(s)sequenceDiagram autonumber participant U as User participant L as BasicLayout participant C as Config/Store participant S as Sidebar U->>L: Load/Resize/Init L->>C: Read current appLayout alt appLayout in ['header-mixed-nav','sidebar-mixed-nav'] (new) L->>S: autoCollapse() S-->>L: collapsed else Other layouts L-->>U: No auto-collapse end note over L,S: Logic otherwise unchanged Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
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 (1)
packages/effects/layouts/src/basic/layout.vue (1)
161-163: Logic change looks good, but consider using computed properties for consistency.The expansion to include both
header-mixed-navandsidebar-mixed-navcorrectly aligns with the PR objective.For better maintainability and consistency with the rest of the codebase (see lines 46-47, 94), consider using the existing computed properties instead of raw string comparison:
- ['header-mixed-nav', 'sidebar-mixed-nav'].includes( - preferences.app.layout, - ) && + (isHeaderMixedNav.value || isSideMixedNav.value) &&This approach is more resilient to potential changes in layout string values and follows the pattern used elsewhere in the file.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/effects/layouts/src/basic/layout.vue(1 hunks)
⏰ 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). (2)
- GitHub Check: post-update (ubuntu-latest)
- GitHub Check: post-update (windows-latest)
🔇 Additional comments (1)
packages/effects/layouts/src/basic/layout.vue (1)
173-175: Verify: Should auto-collapse also trigger on route changes?The
autoCollapseMenuByRouteMetafunction is only called inonMounted, meaning it runs once when the component mounts. If a user navigates to a different route withhideInMenu: trueafter mount, the sidebar won't auto-collapse.Is this mount-only behavior intentional, or should there be a route watcher to handle subsequent navigation? For example:
watch( () => route.path, () => { autoCollapseMenuByRouteMeta(route); } );Please confirm whether auto-collapse should respond to route changes or only on initial mount.
Summary by CodeRabbit