c961dd90 by 任超

stytle:菜单

1 parent a25db879
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-24 17:10:02
-->
<template>
<div v-if="!item.hidden">
<template
......@@ -65,9 +70,9 @@ export default {
})
// When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) {
return true
}
// if (showingChildren.length === 1) {
// return true
// }
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 16:17:42
* @LastEditTime: 2023-03-24 17:10:32
-->
<template>
<div>
......@@ -9,7 +9,7 @@
<el-menu router :default-active="activeMenu" :background-color="variables.menuBg" :text-color="variables.menuText"
:unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical">
<!-- 权限菜单 -->
<sidebar-item v-for="route in permission_routes.slice(4)" :key="route.path" :item="route"
<sidebar-item v-for="route in permission_routes.slice(5)" :key="route.path" :item="route"
:base-path="route.path" />
<!-- 菜单全部展示 -->
<!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
......@@ -50,7 +50,7 @@ export default {
}
},
mounted () {
console.log(this.permission_routes, 'permission_routespermission_routes');
console.log(this.permission_routes.slice(5), 'permission_routes');
}
}
</script>
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-24 16:59:29
* @LastEditTime: 2023-03-24 17:24:52
*/
import Vue from 'vue'
import router from "./router";
......@@ -33,6 +33,7 @@ router.beforeEach(async (to, from, next) => {
if (!hasUser) {
store.dispatch("user/getUserInfo");
}
debugger
if (hasAddRoute) {
next();
} else {
......
......@@ -111,7 +111,7 @@ export default {
let code = this.BASE_API.CODE;
localStorage.setItem("token", `Bearer ${res.content}`);
const { result: getMenuData } = (await getMenuInfo(code)) || [];
let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path
let path1 = JSON.parse(getMenuData[1].metadata)?.path + '/' + JSON.parse(getMenuData[1].children[0].metadata)?.path
//登录成功后需判断有无重定向,没有重定向则跳转首页
const accessRoutes = await this.$store.dispatch(
"permission/generateRoutes",
......