feat: 无法跳转的面包屑

This commit is contained in:
zy7y 2022-09-14 11:29:50 +08:00
parent 78ce85ba57
commit aa20898bc8
5 changed files with 66 additions and 39 deletions

Binary file not shown.

View File

@ -0,0 +1,32 @@
<script setup>
import { useRoute } from "vue-router";
import { computed } from "vue";
const route = useRoute();
const cruPath = computed(() => {
return route.path.substring(1, route.path.length).split("/");
});
console.log(route.path, route.fullPath);
</script>
<template>
<div class="crumb">
<a-breadcrumb>
<a-breadcrumb-item href="">Home</a-breadcrumb-item>
<template v-for="path in cruPath">
<a-breadcrumb-item>
{{ path }}
</a-breadcrumb-item>
</template>
</a-breadcrumb>
</div>
</template>
<style scoped>
.crumb {
display: flex;
align-items: center;
margin-left: 16px;
font-size: 10px;
}
</style>

View File

@ -1,7 +1,8 @@
<script setup>
import { ref } from "vue";
import UserInfo from "@/components/layout/layout-info/layout-info.vue";
import { MenuUnfoldOutlined, MenuFoldOutlined } from "@ant-design/icons-vue";
import HeaderCrumb from "./header-crumb.vue";
import { loadIconCpn } from "@/utils/loadCpn";
//
const collapsed = ref(false);
@ -18,25 +19,36 @@ const clickMenuFold = () => {
<template>
<div class="header">
<menu-unfold-outlined
v-if="collapsed"
class="trigger"
<!-- 左侧菜单收缩控制 -->
<component
class="menu-fold"
:is="loadIconCpn(collapsed ? 'MenuUnfoldOutlined' : 'MenuFoldOutlined')"
@click="clickMenuFold"
/>
<menu-fold-outlined v-else class="trigger" @click="clickMenuFold" />
<UserInfo />
>
</component>
<div class="right">
<HeaderCrumb />
<UserInfo class="info" />
</div>
</div>
</template>
<style scoped>
.trigger {
margin-left: 16px;
.header {
display: flex;
width: 100%;
height: 100%;
padding: 0 16px;
}
.menu-fold {
font-size: 24px;
line-height: 64px;
}
.right {
float: right;
margin-right: 16px;
font-size: 16px;
display: flex;
flex: 1;
justify-content: space-between;
}
</style>

View File

@ -22,7 +22,7 @@ const onClick = ({ key }) => {
</script>
<template>
<div class="right">
<div>
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent>
{{ store.userInfo.nickname }} - {{ store.userInfo.roles[0].name }}
@ -38,4 +38,8 @@ const onClick = ({ key }) => {
</div>
</template>
<style scoped></style>
<style scoped>
div {
font-size: 16px;
}
</style>

View File

@ -2,7 +2,6 @@
import { useRouter } from "vue-router";
import { userStore } from "@/stores/user";
import { loadIconCpn } from "@/utils/loadCpn";
import { ref } from "vue";
const store = userStore();
const router = useRouter();
@ -15,10 +14,7 @@ const menuClick = (menu) => {
<template>
<div class="sider-menu">
<div class="logo">
<img src="@/assets/img/fastapi.svg" />
<h1>Mini RBAC</h1>
</div>
<div class="logo"></div>
<a-menu theme="dark" mode="inline" v-model:selectedKeys="store.selectKey">
<template v-for="menu in store.userMenus" :key="menu.id">
<!-- 0 目录 顶层菜单 -->
@ -46,27 +42,10 @@ const menuClick = (menu) => {
<style scoped>
.logo {
position: relative;
display: flex;
align-items: center;
padding: 16px 16px;
line-height: 32px;
cursor: pointer;
}
.logo img {
display: inline-block;
height: 32px;
vertical-align: middle;
transition: height 0.2s;
}
.logo h1 {
margin: 0 0 0 12px;
overflow: hidden;
color: #fff;
font-weight: 600;
font-size: 18px;
line-height: 32px;
background: rgba(255, 255, 255, 0.3) url("@/assets/img/fastapi.svg");
margin: 16px;
background-size: 100% 100%;
}
</style>