init
All checks were successful
Deploy / build (push) Successful in 2m39s

This commit is contained in:
alsaze
2025-11-27 16:15:29 +03:00
parent ded1c8af22
commit 5f3c4057e7
5 changed files with 128 additions and 4 deletions

View File

@@ -41,9 +41,9 @@
<script setup lang="ts">
import type { TabsItem } from '@nuxt/ui'
import useScreen from '~/composables/useScreen'
import { useMediaQuery } from '@vueuse/core'
const { isMobile } = useScreen()
const isMobile = useMediaQuery('(max-width: 1280px)')
const router = useRouter()
const route = useRoute()
@@ -52,7 +52,7 @@ const tabs = computed<TabsItem[]>(() => [
{
label: isMobile.value ? '' : 'Главная',
icon: 'i-lucide-home',
value: 'index',
value: '/',
route: '/',
},
{
@@ -69,10 +69,20 @@ const tabs = computed<TabsItem[]>(() => [
},
])
const activeTab = ref(route.path.split('/')[1])
const activeTab = ref(route.path.split('/')[1] || '/')
watch(() => activeTab.value, () => {
const tab = tabs.value.find(tab => tab.value === activeTab.value)
router.push(tab.route)
})
watch(() => route.path, () => {
const routerPath = route.path.split('/')[1]
if (routerPath === activeTab.value) {
return
}
activeTab.value = routerPath
})
</script>