Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5767a996
authored
Nov 21, 2022
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
顶部菜单二次点击问题
1 parent
4bfbfcc0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
linkwe-pc/src/layout/components/TopNav/index.vue
linkwe-pc/src/layout/components/TopNav/index.vue
View file @
5767a99
<
template
>
<
template
>
<el-menu
:default-active=
"activeMenu"
background-color=
"transparent"
mode=
"horizontal"
@
select=
"handleSelect"
>
<el-menu
:default-active=
"activeMenu"
background-color=
"transparent"
mode=
"horizontal"
@
select=
"handleSelect"
>
<template
v-for=
"(item, index) in topMenus"
>
<template
v-for=
"(item, index) in topMenus"
>
<el-menu-item
:index=
"item.path"
:key=
"index"
>
{{
item
.
meta
.
title
}}
</el-menu-item>
<el-menu-item
:index=
"item.path"
:key=
"index"
>
{{
item
.
meta
.
title
}}
</el-menu-item>
</
template
>
</
template
>
<!-- 顶部菜单超出数量折叠 -->
<!-- 顶部菜单超出数量折叠 -->
...
@@ -16,10 +16,10 @@
...
@@ -16,10 +16,10 @@
</template>
</template>
<
script
>
<
script
>
import
{
constantRoutes
}
from
'@/router'
import
{
constantRoutes
}
from
'@/router'
import
{
isExternal
}
from
'@/utils/validate'
import
{
isExternal
}
from
'@/utils/validate'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
name
:
''
,
name
:
''
,
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
// 是否为首次加载
// 是否为首次加载
isFrist
:
false
,
isFrist
:
false
,
// 当前激活菜单的
// 当前激活菜单的
currentIndex
:
''
currentIndex
:
''
,
}
}
},
},
computed
:
{
computed
:
{
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
activePath
=
path
activePath
=
path
}
}
return
activePath
return
activePath
}
},
},
},
beforeMount
()
{
beforeMount
()
{
window
.
addEventListener
(
'resize'
,
this
.
setVisibleNumber
)
window
.
addEventListener
(
'resize'
,
this
.
setVisibleNumber
)
...
@@ -155,16 +155,16 @@
...
@@ -155,16 +155,16 @@
// } else {
// } else {
// }
// }
this
.
activeRoutes
(
path
)
this
.
activeRoutes
(
path
)
let
obj
=
this
.
topMenus
[
index
]
//
let obj = this.topMenus[index]
// let path = this.topMenus[index].children[0].path
// let path = this.topMenus[index].children[0].path
// console.log(this.topMenus[index].children[0])
// console.log(this.topMenus[index].children[0])
let
path
=
''
//
let path = ''
if
(
obj
.
children
&&
obj
.
children
.
length
)
{
//
if (obj.children && obj.children.length) {
path
=
path
+
obj
.
children
[
0
].
path
//
path = path + obj.children[0].path
}
//
}
if
(
obj
.
children
[
0
].
children
&&
obj
.
children
[
0
].
children
.
length
)
{
//
if (obj.children[0].children && obj.children[0].children.length) {
path
=
path
+
'/'
+
obj
.
children
[
0
].
children
[
0
].
path
//
path = path + '/' + obj.children[0].children[0].path
}
//
}
if
(
!
isExternal
(
path
))
{
if
(
!
isExternal
(
path
))
{
this
.
$router
.
push
({
path
})
this
.
$router
.
push
({
path
})
}
}
...
@@ -187,43 +187,43 @@
...
@@ -187,43 +187,43 @@
},
},
ishttp
(
url
)
{
ishttp
(
url
)
{
return
url
.
indexOf
(
'http://'
)
!==
-
1
||
url
.
indexOf
(
'https://'
)
!==
-
1
return
url
.
indexOf
(
'http://'
)
!==
-
1
||
url
.
indexOf
(
'https://'
)
!==
-
1
}
},
}
},
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.el-menu
{
.el-menu
{
background-color
:
transparent
!important
;
background-color
:
transparent
!important
;
}
}
.el-menu.el-menu--horizontal
{
.el-menu.el-menu--horizontal
{
border
:
none
!important
;
border
:
none
!important
;
}
}
.el-menu--horizontal
>
.el-menu-item
{
.el-menu--horizontal
>
.el-menu-item
{
float
:
left
;
float
:
left
;
height
:
50px
!important
;
height
:
50px
!important
;
line-height
:
50px
!important
;
line-height
:
50px
!important
;
color
:
#fff
!important
;
color
:
#fff
!important
;
//
padding
:
0
5px
!important
;
//
padding
:
0
5px
!important
;
margin
:
0
10px
!important
;
margin
:
0
10px
!important
;
}
}
.el-menu-item
:hover
{
.el-menu-item
:hover
{
background-color
:
transparent
!important
;
background-color
:
transparent
!important
;
}
}
.el-menu--horizontal
>
.el-menu-item.is-active
,
.el-menu--horizontal
>
.el-menu-item.is-active
,
.el-menu--horizontal
>
.el-submenu.is-active
.el-submenu__title
{
.el-menu--horizontal
>
.el-submenu.is-active
.el-submenu__title
{
border-bottom
:
2px
solid
#fff
!important
;
border-bottom
:
2px
solid
#fff
!important
;
//
color
:
#303133
;
//
color
:
#303133
;
}
}
/* submenu item */
/* submenu item */
.el-menu--horizontal
>
.el-submenu
.el-submenu__title
{
.el-menu--horizontal
>
.el-submenu
.el-submenu__title
{
float
:
left
;
float
:
left
;
height
:
50px
!important
;
height
:
50px
!important
;
line-height
:
50px
!important
;
line-height
:
50px
!important
;
color
:
#999093
!important
;
color
:
#999093
!important
;
padding
:
0
5px
!important
;
padding
:
0
5px
!important
;
margin
:
0
10px
!important
;
margin
:
0
10px
!important
;
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment