mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-04-06 03:57:54 +08:00
refactor(components): 对布局中的组件进行了拆分
This commit is contained in:
parent
b5c7d0a547
commit
d5e46c3473
@ -22,19 +22,8 @@
|
|||||||
|
|
||||||
<n-layout class="h-full bg-hex-f3f4f6" :native-scrollbar="false">
|
<n-layout class="h-full bg-hex-f3f4f6" :native-scrollbar="false">
|
||||||
<n-layout-header bordered class="h-60px flex-y-center">
|
<n-layout-header bordered class="h-60px flex-y-center">
|
||||||
<div class="hover:bg-hex-F3F4F6 hover:shadow-inner h-full px-2 flex-center cursor-pointer">
|
<CollapaseButton />
|
||||||
<Icon icon="carbon:list" class="inline-block" width="18" />
|
<Breadcrumb />
|
||||||
</div>
|
|
||||||
<n-breadcrumb>
|
|
||||||
<n-breadcrumb-item v-for="(item, index) in routes" :key="index">
|
|
||||||
<Icon :icon="item.meta.icon" class="inline-block" width="18" />
|
|
||||||
{{ item.meta.title }}
|
|
||||||
</n-breadcrumb-item>
|
|
||||||
<n-breadcrumb-item v-for="(item, index) in routes" :key="index">
|
|
||||||
<Icon :icon="item.meta.icon" class="inline-block" width="18" />
|
|
||||||
{{ item.meta.title }}
|
|
||||||
</n-breadcrumb-item>
|
|
||||||
</n-breadcrumb>
|
|
||||||
</n-layout-header>
|
</n-layout-header>
|
||||||
<div class="p-16px">
|
<div class="p-16px">
|
||||||
<n-layout-content>
|
<n-layout-content>
|
||||||
@ -51,8 +40,9 @@ import type { MenuOption } from 'naive-ui';
|
|||||||
import { h, ref } from 'vue';
|
import { h, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { Icon } from '@iconify/vue';
|
import { Icon } from '@iconify/vue';
|
||||||
import Logo from '../components/logo.vue';
|
import Logo from '../components/Logo.vue';
|
||||||
import { computed } from 'vue';
|
import Breadcrumb from '../components/Breadcrumb.vue';
|
||||||
|
import CollapaseButton from '../components/CollapaseButton.vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const collapsed = ref(false);
|
const collapsed = ref(false);
|
||||||
@ -118,12 +108,6 @@ const menuOptions: MenuOption[] = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const routes = computed(() => {
|
|
||||||
return router.currentRoute.value.matched.filter((item) => {
|
|
||||||
return item.meta.title;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
37
src/layouts/components/Breadcrumb.vue
Normal file
37
src/layouts/components/Breadcrumb.vue
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<n-breadcrumb>
|
||||||
|
<n-breadcrumb-item class="align-middle">
|
||||||
|
<Icon icon="icon-park-outline:home-two" class="inline-block" width="16" />
|
||||||
|
首页
|
||||||
|
</n-breadcrumb-item>
|
||||||
|
<n-breadcrumb-item v-for="(item, index) in routes" :key="index">
|
||||||
|
<Icon :icon="item.meta.icon" class="inline-block" width="18" />
|
||||||
|
{{ item.meta.title }}
|
||||||
|
</n-breadcrumb-item>
|
||||||
|
</n-breadcrumb>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { Icon } from '@iconify/vue';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
// const props = defineProps({
|
||||||
|
// title: {
|
||||||
|
// type: String,
|
||||||
|
// default: 'Logo2',
|
||||||
|
// },
|
||||||
|
// collapsed: {
|
||||||
|
// type: Boolean,
|
||||||
|
// default: false,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
const routes = computed(() => {
|
||||||
|
return router.currentRoute.value.matched.filter((item) => {
|
||||||
|
return item.meta.title;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
11
src/layouts/components/CollapaseButton.vue
Normal file
11
src/layouts/components/CollapaseButton.vue
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<div class="hover:bg-hex-F3F4F6 hover:shadow-inner h-full px-2 flex-center cursor-pointer">
|
||||||
|
<Icon icon="icon-park-outline:music-list" class="inline-block" width="18" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { Icon } from '@iconify/vue';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
@ -34,7 +34,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('~/src/views/test/test3.vue'),
|
component: () => import('~/src/views/test/test3.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '测试3',
|
title: '测试3',
|
||||||
icon: 'carbon:breaking-change',
|
icon: 'icon-park-outline:music-list',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user