加入图标,开始加入vuex

This commit is contained in:
2023-01-08 00:03:51 +08:00
parent 3eadf4a27a
commit 922fb4ca4a
5 changed files with 55 additions and 14 deletions

View File

@@ -2,15 +2,15 @@
* @Author: Kane
* @Date: 2023-01-04 11:30:33
* @LastEditors: Kane
* @LastEditTime: 2023-01-07 16:44:11
* @LastEditTime: 2023-01-08 00:02:15
* @FilePath: \admin_system\src\layout\components\Aside.vue
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<template>
<el-menu id="side-bar" router default-active="/desktop" unique-opened=true background-color="#223142"
text-color="#fff" active-text-color="#ffd04b">
<el-menu id="side-bar" router :default-active="currentPath" background-color="#223142" text-color="#fff"
active-text-color="#ffd04b">
<template v-for="route in this.routers" :key="route.path">
<template v-if="!route.hidden">
<template v-if="hasOnlyChild(route.children)">
@@ -43,7 +43,7 @@
</template>
<script>
import { useRouter } from "vue-router";
import { useRouter, useRoute } from "vue-router";
export default {
name: "LayoutAside",
@@ -78,6 +78,13 @@ export default {
},
},
computed: {
//获取当前的路由
currentPath()
{
return useRoute().path;
}
},
created()
{
this.routers = useRouter().options.routes;