-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
feat: add support for custom slot header-index, sorted by index #4039
Conversation
框架默认插槽user-dropdown的index:20,notification的index:10 (#4034)
|
WalkthroughThe recent updates enhance the Vue.js application's header management by introducing dynamic slot handling. The components now utilize computed properties to construct and render slot names based on user preferences, allowing for greater adaptability. This change improves the overall functionality while maintaining the existing logic of the application, making it easier to manage header elements. Changes
Assessment against linked issues
Poem
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apps/web-antd/src/layouts/basic.vue (1 hunks)
- packages/effects/layouts/src/basic/header/header.vue (3 hunks)
- packages/effects/layouts/src/basic/layout.vue (3 hunks)
Files skipped from review due to trivial changes (1)
- apps/web-antd/src/layouts/basic.vue
Additional comments not posted (6)
packages/effects/layouts/src/basic/header/header.vue (3)
2-2
: LGTM!The import statement for
useSlots
is correct and necessary for accessing slot definitions dynamically.
28-43
: LGTM! Consider adding a comment for clarity.The computed property
headerSlots
correctly constructs and sorts the slot list based on the index. This enhances the flexibility of slot rendering. For better readability, consider adding a comment explaining the logic.+ // Dynamically generate and sort header slots based on the index. const headerSlots = computed(() => { ... });
63-65
: LGTM!The template updates correctly use the
v-for
directive withheaderSlots
to render slots dynamically. This improves the flexibility and maintainability of the template.packages/effects/layouts/src/basic/layout.vue (3)
2-2
: LGTM!The import statement for
useSlots
is correct and necessary for accessing slot definitions dynamically.
151-159
: LGTM! Consider adding a comment for clarity.The computed property
headerSlots
correctly constructs the slot list based on the prefix "header-". This enhances the flexibility of slot rendering. For better readability, consider adding a comment explaining the logic.+ // Dynamically generate header slots based on the prefix "header-". const headerSlots = computed(() => { ... });
252-254
: LGTM!The template updates correctly use the
v-for
directive withheaderSlots
to render slots dynamically. This improves the flexibility and maintainability of the template.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/effects/layouts/src/basic/header/header.vue (3 hunks)
- packages/effects/layouts/src/basic/layout.vue (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- packages/effects/layouts/src/basic/header/header.vue
- packages/effects/layouts/src/basic/layout.vue
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/effects/layouts/src/basic/layout.vue (3 hunks)
Additional comments not posted (3)
packages/effects/layouts/src/basic/layout.vue (3)
4-4
: Import statement is correct.The
useSlots
function is correctly imported from 'vue'.
149-152
: Computed property implementation is correct.The
headerSlots
computed property correctly filters slot names that start with 'header-'.
245-247
: Template changes are correct.The
v-for
loop correctly renders slots based onheaderSlots
.
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/effects/layouts/src/basic/README.md (1 hunks)
- packages/effects/layouts/src/basic/header/header.vue (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/effects/layouts/src/basic/header/header.vue
Additional comments not posted (1)
packages/effects/layouts/src/basic/README.md (1)
1-7
: Documentation is clear and concise.The README file provides clear instructions on the custom slot naming conventions and sorting order for the header. Ensure that the implementation aligns with this documentation.
框架默认插槽user-dropdown的index:30,notification的index:25
closes #4034
Description
Type of change
Please delete options that are not relevant.
pnpm-lock.yaml
unless you introduce a new test example.Checklist
pnpm run docs:dev
command.pnpm test
.feat:
,fix:
,perf:
,docs:
, orchore:
.Summary by CodeRabbit
New Features
Bug Fixes
Documentation