Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DC-TOM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘照晖
DC-TOM
Commits
465f2219
Commit
465f2219
authored
May 19, 2025
by
蔡伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/layout-style' into 'dev'
feat(*): 路由跳转问题修改 See merge request
!2
parents
9243b184
7a56a91f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
65 deletions
+70
-65
index.vue
src/layout/index.vue
+5
-5
menuCom.vue
src/layout/menuCom.vue
+19
-4
index.js
src/router/index.js
+41
-56
index.vue
src/views/dashboard/index.vue
+5
-0
No files found.
src/layout/index.vue
View file @
465f2219
...
@@ -57,11 +57,11 @@ export default {
...
@@ -57,11 +57,11 @@ export default {
if
(
route
.
matched
&&
route
.
matched
.
length
>
0
)
{
if
(
route
.
matched
&&
route
.
matched
.
length
>
0
)
{
const
matchedRoutes
=
route
.
matched
;
const
matchedRoutes
=
route
.
matched
;
// 添加首页项(可选)
//
//
添加首页项(可选)
breadcrumbList
.
value
.
push
({
//
breadcrumbList.value.push({
path
:
'/dashboard'
,
//
path: '/dashboard',
meta
:
{
title
:
'首页'
}
//
meta: { title: '首页' }
});
//
});
// 添加匹配的路由
// 添加匹配的路由
matchedRoutes
.
forEach
(
item
=>
{
matchedRoutes
.
forEach
(
item
=>
{
...
...
src/layout/menuCom.vue
View file @
465f2219
...
@@ -16,13 +16,15 @@
...
@@ -16,13 +16,15 @@
<el-icon><location
/></el-icon>
<el-icon><location
/></el-icon>
<span>
{{
getMenuTitle
(
item
)
}}
</span>
<span>
{{
getMenuTitle
(
item
)
}}
</span>
</
template
>
</
template
>
<el-menu-item
v-for=
"(item_son, index_son) in item.children"
:key=
"item_son.path"
:index=
"index + '_' + index_son"
>
<el-menu-item
v-for=
"(item_son, index_son) in item.children"
:key=
"item_son.path"
:index=
"index + '_' + index_son"
<router-link
:to=
"item.path + '/' + item_son.path"
>
{{getMenuTitle(item_son)}}
</router-link>
@
click=
"handleClick(item_son.path)"
>
<span>
{{getMenuTitle(item_son)}}
</span>
<!-- <router-link :to="item.path + '/' + item_son.path">{{getMenuTitle(item_son)}}</router-link> -->
</el-menu-item>
</el-menu-item>
</el-sub-menu>
</el-sub-menu>
<el-menu-item
v-else
:index=
"index + ''"
class=
"submenu-box"
>
<el-menu-item
v-else
:index=
"index + ''"
class=
"submenu-box"
@
click=
"handleClick(item.path)"
>
<el-icon><setting
/></el-icon>
<el-icon><setting
/></el-icon>
<span>
<router-link
:to=
"item.path"
>
{{getMenuTitle(item)}}
</router-link>
</span>
<span>
{{getMenuTitle(item)}}
</span>
</el-menu-item>
</el-menu-item>
</template>
</template>
</el-menu>
</el-menu>
...
@@ -38,6 +40,19 @@ import {
...
@@ -38,6 +40,19 @@ import {
Setting
,
Setting
,
}
from
"@element-plus/icons-vue"
;
}
from
"@element-plus/icons-vue"
;
import
{
routes
}
from
"../router/index.js"
;
import
{
routes
}
from
"../router/index.js"
;
import
{
useRouter
}
from
'vue-router'
const
router
=
useRouter
()
const
handleClick
=
(
path
)
=>
{
console
.
log
(
path
);
if
(
path
.
startsWith
(
'/'
))
{
router
.
push
(
path
)
// 绝对路径,直接跳转
}
else
{
router
.
push
(
'/'
+
path
)
// 相对路径,补全
}
}
const
routerList
=
routes
[
0
].
children
;
const
routerList
=
routes
[
0
].
children
;
const
handleOpen
=
(
key
,
keyPath
)
=>
{
const
handleOpen
=
(
key
,
keyPath
)
=>
{
console
.
log
(
key
,
keyPath
);
console
.
log
(
key
,
keyPath
);
...
...
src/router/index.js
View file @
465f2219
import
{
createWebHistory
,
createRouter
}
from
'vue-router'
import
{
createWebHistory
,
createRouter
}
from
'vue-router'
import
Dashboard
from
'../views/dashboard/index.vue'
import
HomeView
from
'../views/HomeView.vue'
import
HomeView
from
'../views/HomeView.vue'
import
AboutView
from
'../views/AboutView.vue'
import
AboutView
from
'../views/AboutView.vue'
import
User
from
'../views/user.vue'
import
User
from
'../views/user.vue'
...
@@ -11,65 +12,49 @@ const routes = [
...
@@ -11,65 +12,49 @@ const routes = [
path
:
'/'
,
path
:
'/'
,
component
:
Layout
,
component
:
Layout
,
children
:
[
children
:
[
{
{
path
:
'/dashboard'
,
path
:
'/dashboard'
,
component
:
AboutView
,
component
:
Dashboard
,
meta
:
{
meta
:
{
title
:
'首页'
},
title
:
'首页'
,
},
},
{
},
path
:
'/overview'
,
{
component
:
HomeView
,
path
:
'/2'
,
meta
:
{
title
:
'除尘器总览'
},
},
{
path
:
'/device-management'
,
component
:
AboutView
,
meta
:
{
title
:
'设备管理'
},
},
{
path
:
'/monitor'
,
component
:
AboutView
,
meta
:
{
title
:
'除尘器监控'
},
},
{
path
:
'/alerts'
,
component
:
AboutView
,
meta
:
{
title
:
'告警总览'
},
},
{
path
:
'/my-loop'
,
meta
:
{
title
:
'我的闭环'
},
children
:
[
{
path
:
'/my-loop/profile'
,
component
:
HomeView
,
component
:
HomeView
,
meta
:
{
meta
:
{
title
:
'我的待办'
},
title
:
'除尘器总览'
,
},
},
{
},
path
:
'/my-loop/posts'
,
{
path
:
'/3'
,
component
:
AboutView
,
meta
:
{
title
:
'设备管理'
,
},
},
{
path
:
'/4'
,
component
:
AboutView
,
component
:
AboutView
,
meta
:
{
meta
:
{
title
:
'我的已办'
},
title
:
'除尘器监控'
,
},
},
]
},
},
{
path
:
'/5'
,
component
:
AboutView
,
meta
:
{
title
:
'告警总览'
,
},
},
{
path
:
'/6'
,
meta
:
{
title
:
'我的闭环'
,
},
children
:
[
{
path
:
'profile'
,
component
:
HomeView
,
meta
:
{
title
:
'我的待办'
,
},
},
{
path
:
'posts'
,
component
:
AboutView
,
meta
:
{
title
:
'我的已办'
,
},
},
],
},
]
]
},
},
{
{
path
:
'/login'
,
path
:
'/login'
,
component
:
Login
,
component
:
Login
,
...
...
src/views/dashboard/index.vue
0 → 100644
View file @
465f2219
<
template
>
<div
class=
"page-container"
>
dashborad
</div>
</
template
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment