fix(菜单): 防重点击
This commit is contained in:
parent
935c1d652e
commit
7c495db38a
|
@ -6,7 +6,7 @@
|
||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
@menu-item-click="menuClickHandler"
|
@menu-item-click="menuClickHandler"
|
||||||
>
|
>
|
||||||
<a-menu-item v-for="menu of appStore.getTopMenus" :key="(menu.name as string)" @click="jumpPath(menu.name)">
|
<a-menu-item v-for="menu of appStore.getTopMenus" :key="(menu.name as string)">
|
||||||
{{ t(menu.meta?.locale || '') }}
|
{{ t(menu.meta?.locale || '') }}
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Ref, ref, watch } from 'vue';
|
import { Ref, ref, watch } from 'vue';
|
||||||
import { RouteRecordName, RouteRecordRaw, useRouter } from 'vue-router';
|
import { RouteRecordName, RouteRecordRaw, useRouter } from 'vue-router';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep, debounce } from 'lodash-es';
|
||||||
|
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import usePermission from '@/hooks/usePermission';
|
import usePermission from '@/hooks/usePermission';
|
||||||
|
@ -108,12 +108,10 @@
|
||||||
setCurrentTopMenu('');
|
setCurrentTopMenu('');
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
function jumpPath(route: RouteRecordName | undefined) {
|
const menuClickHandler = debounce((route: RouteRecordName | undefined) => {
|
||||||
router.push({ name: route });
|
|
||||||
}
|
|
||||||
function menuClickHandler() {
|
|
||||||
activeMenus.value = [appStore.getCurrentTopMenu?.name || ''];
|
activeMenus.value = [appStore.getCurrentTopMenu?.name || ''];
|
||||||
}
|
router.push({ name: route });
|
||||||
|
}, 150);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => appStore.currentOrgId,
|
() => appStore.currentOrgId,
|
||||||
|
|
Loading…
Reference in New Issue