fix: user dropdown event response failure

修正顶部用户下拉菜单不响应点击事件的问题
This commit is contained in:
无木 2021-06-27 02:31:27 +08:00
parent 81a0f478af
commit c73694ab8b

View File

@ -10,10 +10,11 @@
</span> </span>
<template #overlay> <template #overlay>
<Menu @click="handleMenuClick"> <Menu>
<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"
/> />
@ -21,11 +22,13 @@
<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"
/> />
@ -54,7 +57,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',
@ -95,28 +98,31 @@
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,
}; };
}, },
}); });