Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
20d7a25e
Commit
20d7a25e
authored
Jun 27, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: user drop-down event key loss
修复顶部的用户操作下拉菜单点击事件丢失key参数的问题
parent
59d3e8c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
24 deletions
+23
-24
DropMenuItem.vue
.../default/header/components/user-dropdown/DropMenuItem.vue
+7
-2
index.vue
...layouts/default/header/components/user-dropdown/index.vue
+16
-22
No files found.
src/layouts/default/header/components/user-dropdown/DropMenuItem.vue
View file @
20d7a25e
<
template
>
<
template
>
<MenuItem
:key=
"
k
ey"
>
<MenuItem
:key=
"
itemK
ey"
>
<span
class=
"flex items-center"
>
<span
class=
"flex items-center"
>
<Icon
:icon=
"icon"
class=
"mr-1"
/>
<Icon
:icon=
"icon"
class=
"mr-1"
/>
<span>
{{
text
}}
</span>
<span>
{{
text
}}
</span>
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Menu
}
from
'
ant-design-vue
'
;
import
{
Menu
}
from
'
ant-design-vue
'
;
import
{
defineComponent
}
from
'
vue
'
;
import
{
computed
,
defineComponent
,
getCurrentInstance
}
from
'
vue
'
;
import
Icon
from
'
/@/components/Icon/index
'
;
import
Icon
from
'
/@/components/Icon/index
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
import
{
propTypes
}
from
'
/@/utils/propTypes
'
;
...
@@ -22,5 +22,10 @@
...
@@ -22,5 +22,10 @@
text
:
propTypes
.
string
,
text
:
propTypes
.
string
,
icon
:
propTypes
.
string
,
icon
:
propTypes
.
string
,
},
},
setup
(
props
)
{
const
instance
=
getCurrentInstance
();
const
itemKey
=
computed
(()
=>
props
.
key
||
instance
?.
vnode
?.
props
?.
key
);
return
{
itemKey
};
},
});
});
</
script
>
</
script
>
src/layouts/default/header/components/user-dropdown/index.vue
View file @
20d7a25e
...
@@ -10,11 +10,10 @@
...
@@ -10,11 +10,10 @@
</span>
</span>
<template
#overlay
>
<template
#overlay
>
<Menu>
<Menu
@
click=
"handleMenuClick"
>
<MenuItem
<MenuItem
key=
"doc"
key=
"doc"
:text=
"t('layout.header.dropdownItemDoc')"
:text=
"t('layout.header.dropdownItemDoc')"
@
click=
"openDoc"
icon=
"ion:document-text-outline"
icon=
"ion:document-text-outline"
v-if=
"getShowDoc"
v-if=
"getShowDoc"
/>
/>
...
@@ -22,13 +21,11 @@
...
@@ -22,13 +21,11 @@
<MenuItem
<MenuItem
v-if=
"getUseLockPage"
v-if=
"getUseLockPage"
key=
"lock"
key=
"lock"
@
click=
"handleLock"
:text=
"t('layout.header.tooltipLock')"
:text=
"t('layout.header.tooltipLock')"
icon=
"ion:lock-closed-outline"
icon=
"ion:lock-closed-outline"
/>
/>
<MenuItem
<MenuItem
key=
"logout"
key=
"logout"
@
click=
"handleLoginOut"
:text=
"t('layout.header.dropdownItemLoginOut')"
:text=
"t('layout.header.dropdownItemLoginOut')"
icon=
"ion:power-outline"
icon=
"ion:power-outline"
/>
/>
...
@@ -57,7 +54,7 @@
...
@@ -57,7 +54,7 @@
import
{
createAsyncComponent
}
from
'
/@/utils/factory/createAsyncComponent
'
;
import
{
createAsyncComponent
}
from
'
/@/utils/factory/createAsyncComponent
'
;
//
type MenuEvent = 'logout' | 'doc' | 'lock';
type
MenuEvent
=
'
logout
'
|
'
doc
'
|
'
lock
'
;
export
default
defineComponent
({
export
default
defineComponent
({
name
:
'
UserDropdown
'
,
name
:
'
UserDropdown
'
,
...
@@ -98,31 +95,28 @@
...
@@ -98,31 +95,28 @@
openWindow
(
DOC_URL
);
openWindow
(
DOC_URL
);
}
}
//
function handleMenuClick(e: { key: MenuEvent }) {
function
handleMenuClick
(
e
:
{
key
:
MenuEvent
})
{
//
switch (e.key) {
switch
(
e
.
key
)
{
//
case 'logout':
case
'
logout
'
:
//
handleLoginOut();
handleLoginOut
();
//
break;
break
;
//
case 'doc':
case
'
doc
'
:
//
openDoc();
openDoc
();
//
break;
break
;
//
case 'lock':
case
'
lock
'
:
//
handleLock();
handleLock
();
//
break;
break
;
//
}
}
//
}
}
return
{
return
{
prefixCls
,
prefixCls
,
t
,
t
,
getUserInfo
,
getUserInfo
,
//
handleMenuClick,
handleMenuClick
,
getShowDoc
,
getShowDoc
,
register
,
register
,
getUseLockPage
,
getUseLockPage
,
handleLoginOut
,
openDoc
,
handleLock
,
};
};
},
},
});
});
...
...
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