Commit a49e0935 by 胡悦

提交优化

1 parent 78cc3786
...@@ -11,29 +11,8 @@ import Menu from '@/components/Menu/index.vue'; ...@@ -11,29 +11,8 @@ import Menu from '@/components/Menu/index.vue';
</script> </script>
<template> <template>
<div class="layout">
<a-layout>
<a-layout-header><NavBar /></a-layout-header>
<a-layout>
<a-layout-sider>
<Menu />
</a-layout-sider>
<a-layout-content class="content">
<router-view></router-view> <router-view></router-view>
</a-layout-content>
</a-layout>
</a-layout>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.content {
box-sizing: border-box;
width: 100%;
height: calc(100vh - 48px);
background-color: #f7f8f9;
box-sizing: border-box;
padding: 16px 20px;
overflow-y: auto
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-07-24 20:28:10 * @Date: 2024-07-24 20:28:10
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-10-17 17:38:27 * @LastEditTime: 2024-10-18 16:02:45
--> -->
<script lang="ts" setup> <script lang="ts" setup>
...@@ -14,15 +14,11 @@ import { useRouter, useRoute } from 'vue-router'; ...@@ -14,15 +14,11 @@ import { useRouter, useRoute } from 'vue-router';
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
let defaultSelectedKeys = ref(['']); let defaultSelectedKeys = ref(['']);
const menuList = ref(staticRoutes.filter(item => item.isMenu)); const routerList = staticRoutes.find(item => item.path === '/layout')?.children;
const menuList = ref(routerList!.filter(item => item.isMenu));
onBeforeMount (() => { onBeforeMount (() => {
console.log(route) const _parentPath = routerList!.find(item => item.path === route.path)?.parentPath
if (route.path == '/login') { defaultSelectedKeys.value = _parentPath === undefined ? ['/investorRelated'] : [_parentPath]
defaultSelectedKeys.value = ['/investorRelated']
} else {
const _parentPath = staticRoutes.find(item => item.path === route.path)?.parentPath
defaultSelectedKeys.value = [_parentPath]
}
}) })
</script> </script>
<template> <template>
......
...@@ -17,6 +17,10 @@ const staticRoutes = Object.freeze([ ...@@ -17,6 +17,10 @@ const staticRoutes = Object.freeze([
component: () => import('views/login/index.vue'), component: () => import('views/login/index.vue'),
}, },
{ {
path: '/layout',
component: () => import('views/layout/index.vue'),
children: [
{
id: '1', id: '1',
name: '投资者相关', name: '投资者相关',
path: '/investorRelated', path: '/investorRelated',
...@@ -48,10 +52,6 @@ const staticRoutes = Object.freeze([ ...@@ -48,10 +52,6 @@ const staticRoutes = Object.freeze([
component: () => import('views/news/AddNews.vue'), component: () => import('views/news/AddNews.vue'),
} }
// { // {
// path: '/layout',
// component: () => import('views/layout/index.vue'),
// children: [
// {
// name: '投资者相关', // name: '投资者相关',
// path: '/layout/investorRelated', // path: '/layout/investorRelated',
// component: () => import('views/investorRelated/index.vue') // component: () => import('views/investorRelated/index.vue')
...@@ -66,7 +66,7 @@ const staticRoutes = Object.freeze([ ...@@ -66,7 +66,7 @@ const staticRoutes = Object.freeze([
// path: '/layout/news', // path: '/layout/news',
// component: () => import('views/news/index.vue'), // component: () => import('views/news/index.vue'),
// } // }
// ] ]
// }, },
]) ])
export default staticRoutes export default staticRoutes
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!