diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index ec4fd40..db3c2b5 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -114,7 +114,7 @@ const activeMenu = computed(() => { function setVisibleNumber(): void { const width = document.body.getBoundingClientRect().width / 3 - visibleNumber.value = parseInt(String(width / 85)) + visibleNumber.value = Math.max(1, parseInt(String(width / 85))) } function handleSelect(key: string, keyPath: string[]): void { diff --git a/src/layout/components/TopBar/index.vue b/src/layout/components/TopBar/index.vue index 1ffb454..777b2b3 100644 --- a/src/layout/components/TopBar/index.vue +++ b/src/layout/components/TopBar/index.vue @@ -38,11 +38,11 @@ const topMenus = computed(() => { return permissionStore.sidebarRouters.filter((f: any) => !f.hidden).slice(0, visibleNumber.value) }) const moreRoutes = computed(() => { - return permissionStore.sidebarRouters.filter((f: any) => !f.hidden).slice(visibleNumber.value, sidebarRouters.value.length - visibleNumber.value) + return permissionStore.sidebarRouters.filter((f: any) => !f.hidden).slice(visibleNumber.value) }) function setVisibleNumber(): void { const width = document.body.getBoundingClientRect().width / 3 - visibleNumber.value = parseInt(String(width / 85)) + visibleNumber.value = Math.max(1, parseInt(String(width / 85))) } onMounted(() => {