feat(frontend): 抽离页眉为公共组件;修复导航点击事件
- 新增 navbar-component.js:固定页眉,统一标题、用户信息、退出按钮 - 重构所有页面(index/topics/logs/admin/users)使用 navbar-component - 清理原有 navbar 相关样式,避免冲突 - 导航组件增加 main-content padding-top 自动调整 - 修复导航按钮点击事件(确保 触发) - 导航组件样式强应用,解决遮挡和布局问题
This commit is contained in:
@@ -68,18 +68,17 @@
|
||||
</style>
|
||||
|
||||
<script src="navigation-component.js"></script>
|
||||
|
||||
<script src="navbar-component.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<nav class="navbar">
|
||||
<div class="navbar-content">
|
||||
<h1 class="navbar-title">宇之然内容创作平台 - 系统</h1>
|
||||
<div class="navbar-user">
|
||||
<div class="user-info"><div class="avatar">{{ currentUser.username.charAt(0).toUpperCase() }}</div><span>{{ currentUser.username }}</span></div>
|
||||
<el-button type="danger" size="small" @click="handleLogout">退出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<navbar-component
|
||||
title="系统管理"
|
||||
:username="currentUser.username"
|
||||
:is-admin="isAdmin"
|
||||
@logout="handleLogout"
|
||||
></navbar-component>
|
||||
|
||||
<navigation-component
|
||||
current-page="admin"
|
||||
@@ -396,6 +395,8 @@ const app = createApp({
|
||||
});
|
||||
|
||||
app.use(ElementPlus);
|
||||
// 安装导航组件
|
||||
if (window.installNavbar) { window.installNavbar(app); }
|
||||
// 安装导航组件
|
||||
if (window.installNavigation) { window.installNavigation(app); } else if (window.NavigationComponent) { app.component("navigation-component", window.NavigationComponent); }
|
||||
app.mount('#app');
|
||||
|
||||
Reference in New Issue
Block a user