feat(router): 重新添加主页路由并更新侧边栏样式

- 在 app/index.js 中重新添加主页路由
- 在 generatedRouter/index.js 中添加主页路由的动态导入- 更新 Logo.vue 中的 logo 图片和样式
- 调整 Sidebar.vue 中的 logo 位置和样式
This commit is contained in:
du.meimei
2025-04-23 11:44:57 +08:00
parent 33010a65c9
commit 190ebd8d9d
5 changed files with 45 additions and 20 deletions

BIN
src/assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -42,18 +42,18 @@ export default [
hidden: true, hidden: true,
children: [{ path: '/404', component: notFound }] children: [{ path: '/404', component: notFound }]
}, },
{ // {
path: '/', // path: '/',
component: layout, // component: layout,
redirect: '/home', // redirect: '/home',
name: 'home', // name: 'home',
hidden: true, // hidden: true,
children: [ // children: [
{ // {
path: 'home', // path: 'home',
component: home // component: home
} // }
] // ]
}, // },
{ path: '*', redirect: '/404', hidden: true } { path: '*', redirect: '/404', hidden: true }
] ]

View File

@@ -1,7 +1,30 @@
import layout from '@/views/app/layout/layout.vue' import layout from '@/views/app/layout/layout.vue'
import redirect from '@/views/app/redirect/index.vue' import redirect from '@/views/app/redirect/index.vue'
const home = () => import('@/views/app/Home')
export default [ export default [
{
path: '/',
component: layout,
redirect: '/home',
name: 'home',
meta: {
title: '主页',
icon: 'el-icon-s-home',
affix: true
},
children: [
{
path: '/home',
name: 'home-page',
component: home,
meta: {
title: '主页',
icon: 'el-icon-s-home'
}
}
]
},
{ {
path: '/knowledge', path: '/knowledge',
name: 'knowledge', name: 'knowledge',

View File

@@ -14,7 +14,7 @@
</template> </template>
<script> <script>
import u3 from '@/assets/images/icon/u3.png' import logo from '@/assets/images/logo.png'
export default { export default {
name: 'SidebarLogo', name: 'SidebarLogo',
props: { props: {
@@ -26,7 +26,7 @@ export default {
data() { data() {
return { return {
title: 'Vue Admin Template', title: 'Vue Admin Template',
logo: u3 logo
} }
} }
} }
@@ -45,7 +45,6 @@ export default {
.sidebar-logo-container { .sidebar-logo-container {
position: relative; position: relative;
width: 60px; width: 60px;
height: 60px;
line-height: 50px; line-height: 50px;
/*background: #2b2f3a;*/ /*background: #2b2f3a;*/
text-align: center; text-align: center;
@@ -56,8 +55,8 @@ export default {
width: 100%; width: 100%;
& .sidebar-logo { & .sidebar-logo {
width: 160px; width: 35px;
height: 65px; //height: 65px;
vertical-align: middle; vertical-align: middle;
margin-right: 12px; margin-right: 12px;
} }

View File

@@ -191,7 +191,6 @@ export default {
// 获取路由数据 // 获取路由数据
let data = this.$store.state.app.sidebarList let data = this.$store.state.app.sidebarList
// 只获取顶级路由,不需要硬编码路径
// 通过检查路由结构来确定顶级菜单 // 通过检查路由结构来确定顶级菜单
const topLevelRoutes = data.filter(route => { const topLevelRoutes = data.filter(route => {
// 如果路由有 meta 和 children则认为它是顶级菜单 // 如果路由有 meta 和 children则认为它是顶级菜单
@@ -248,8 +247,12 @@ export default {
background-color: #fff; background-color: #fff;
padding: 0 10px; padding: 0 10px;
text-align: center; text-align: center;
display: flex;
flex-direction: column;
align-items: center;
.logo { .logo {
margin-bottom: 90px; margin-top: 30px;
margin-bottom: 40px;
} }
} }