witHeader Top Navigation Bar
witHeader is a top navigation bar component that includes system Logo, horizontal menu, and right tool area, supports dynamic route menu generation and theme style customization.
Usage Example
vue
<template>
<div class="app-container">
<witHeader />
<main class="app-main">
<!-- Main content area -->
</main>
</div>
</template>
<script lang="ts" setup>
// Component will automatically get route data from routesStore and render menu
</script>
<style>
.app-container {
display: flex;
flex-direction: column;
height: 100vh;
}
.app-main {
flex: 1;
padding: 20px;
overflow-y: auto;
}
</style>API
| Property Name | Type | Default Value | Description |
|---|---|---|---|
layout | [String] | 'horizontal' | Menu layout method, currently only supports 'horizontal' |
Slots
| Slot Name | Description |
|---|---|
| None | Component does not provide slots |
Events
| Event Name | Description | Parameters |
|---|---|---|
| None | Component does not trigger external events | - |
Features
- System Logo: Integrates
wit-logocomponent, displays system logo - Horizontal Menu: Implemented based on Element Plus Menu component, only supports horizontal layout
- Dynamic Routes: Gets route data from
routesStore, automatically generates menu items - Menu Highlight: Automatically highlights based on currently active menu
- Right Tools: Integrates
wit-right-toolscomponent, provides system tool buttons - Theme Adaptation: Uses Element Plus CSS variables, supports theme switching
Route Configuration
Menu data comes from route configuration, route objects need to contain the following meta information:
| Property Name | Type | Description |
|---|---|---|
meta.title | [String] | Menu item display text |
meta.icon | [String] | Menu item icon name |
meta.levelHidden | [Boolean] | Whether to hide current level, directly display child level menu |
Usage Tips
TIP
- Component depends on
routesStoreto get route data, ensure route configuration is correct - Currently only supports horizontal layout (
layout="horizontal") - Menu item active state is controlled by
activeMenuinroutesStore - Supports multi-level menus, submenus will display as popups
- Component styles use CSS variables, can be customized through theme configuration
- Right tool area integrates
wit-right-toolscomponent, ensure the component is correctly installed - Menu item click events are handled internally by
wit-menucomponent, implementing route navigation
