菜单跳转功能优化
This commit is contained in:
@@ -82,25 +82,24 @@
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b"
|
||||
@select="handleSelect"
|
||||
router>
|
||||
<el-menu-item index="1" route="/">
|
||||
@select="handleSelect">
|
||||
<el-menu-item index="1">
|
||||
<i class="el-icon-s-home"></i>
|
||||
<span slot="title">首页概览</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="2" route="/plugins">
|
||||
<el-menu-item index="2">
|
||||
<i class="el-icon-s-grid"></i>
|
||||
<span slot="title">插件统计</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="3" route="/users">
|
||||
<el-menu-item index="3">
|
||||
<i class="el-icon-user"></i>
|
||||
<span slot="title">用户统计</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4" route="/groups">
|
||||
<el-menu-item index="4">
|
||||
<i class="el-icon-s-cooperation"></i>
|
||||
<span slot="title">群组统计</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="5" route="/errors">
|
||||
<el-menu-item index="5">
|
||||
<i class="el-icon-warning"></i>
|
||||
<span slot="title">错误日志</span>
|
||||
</el-menu-item>
|
||||
@@ -148,7 +147,21 @@
|
||||
methods: {
|
||||
handleSelect(key, keyPath) {
|
||||
this.currentView = key;
|
||||
this.loadData();
|
||||
// 添加页面跳转逻辑
|
||||
const routes = {
|
||||
'1': '/',
|
||||
'2': '/plugins',
|
||||
'3': '/users',
|
||||
'4': '/groups',
|
||||
'5': '/errors'
|
||||
};
|
||||
|
||||
// 如果当前不在对应页面,则跳转
|
||||
const currentPath = window.location.pathname;
|
||||
const targetPath = routes[key];
|
||||
if (currentPath !== targetPath && targetPath !== undefined) {
|
||||
window.location.href = targetPath;
|
||||
}
|
||||
},
|
||||
loadData() {
|
||||
// 由子组件实现
|
||||
|
||||
Reference in New Issue
Block a user