Skip to content

Commit

Permalink
feat: add breadcrumb navigation (#74)
Browse files Browse the repository at this point in the history
* feat: breadcrumb navigation

* style: delete empty lines and useless elements
  • Loading branch information
kongcodes authored Apr 30, 2022
1 parent 93b34a6 commit 9de3f22
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/layouts/default/header/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<a-breadcrumb class="!ml-2">
<a-breadcrumb-item v-for="(item,index) in routes" :key="index">
{{ item.meta.title }}
</a-breadcrumb-item>
</a-breadcrumb>
</template>

<script setup lang="ts">
const route = useRoute()
const router = useRouter()
const routes = ref(route.matched)
router.afterEach((to) => {
routes.value = to.matched
})
</script>
5 changes: 4 additions & 1 deletion src/layouts/default/header/index.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<template>
<a-layout-header :class="getHeaderClass">
<div class="h-full">
<div class="h-full flex items-center">
<sider-trigger class="layout-header-action" />
<breadcrumb />
</div>

<div class="flex h-full">
<full-screen class="layout-header-action" />
<user-dropdown class="layout-header-action" />
Expand All @@ -18,6 +20,7 @@ import SiderTrigger from './components/SiderTrigger.vue'
import FullScreen from './components/FullScreen.vue'
import UserDropdown from './components/UserDropdown.vue'
import SettingDrawer from './components/SettingDrawer.vue'
import Breadcrumb from './components/Breadcrumb.vue'
const { getCollapsed } = useCollapsed()
Expand Down

0 comments on commit 9de3f22

Please sign in to comment.