Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
119becb0
Commit
119becb0
authored
Mar 08, 2018
by
杨奕
Committed by
GitHub
Mar 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Menu: update SubMenu to allow custom component (#10077)
parent
99e5a6b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
packages/menu/src/submenu.vue
packages/menu/src/submenu.vue
+17
-4
No files found.
packages/menu/src/submenu.vue
View file @
119becb0
...
...
@@ -66,7 +66,7 @@
computed
:
{
// popper option
appendToBody
()
{
return
this
.
rootMenu
===
this
.
$parent
;
return
this
.
isFirstLevel
;
},
menuTransitionName
()
{
return
this
.
rootMenu
.
collapse
?
'
el-zoom-in-left
'
:
'
el-zoom-in-top
'
;
...
...
@@ -125,6 +125,19 @@
?
this
.
activeTextColor
:
this
.
textColor
};
},
isFirstLevel
()
{
let
isFirstLevel
=
true
;
let
parent
=
this
.
$parent
;
while
(
parent
&&
parent
!==
this
.
rootMenu
)
{
if
([
'
ElSubmenu
'
,
'
ElMenuItemGroup
'
].
indexOf
(
parent
.
$options
.
componentName
)
>
-
1
)
{
isFirstLevel
=
false
;
break
;
}
else
{
parent
=
parent
.
$parent
;
}
}
return
isFirstLevel
;
}
},
methods
:
{
...
...
@@ -196,7 +209,7 @@
title
&&
(
title
.
style
.
backgroundColor
=
this
.
rootMenu
.
backgroundColor
||
''
);
},
updatePlacement
()
{
this
.
currentPlacement
=
this
.
mode
===
'
horizontal
'
&&
this
.
rootMenu
===
this
.
$parent
this
.
currentPlacement
=
this
.
mode
===
'
horizontal
'
&&
this
.
isFirstLevel
?
'
bottom-start
'
:
'
right-start
'
;
},
...
...
@@ -232,7 +245,7 @@
disabled
,
popperClass
,
$slots
,
$parent
isFirstLevel
}
=
this
;
const
popupMenu
=
(
...
...
@@ -267,7 +280,7 @@
);
const
submenuTitleIcon
=
(
rootMenu
.
mode
===
'
horizontal
'
&&
$parent
===
rootMenu
||
rootMenu
.
mode
===
'
horizontal
'
&&
isFirstLevel
||
rootMenu
.
mode
===
'
vertical
'
&&
!
rootMenu
.
collapse
)
?
'
el-icon-arrow-down
'
:
'
el-icon-arrow-right
'
;
...
...
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