64 lines
2.1 KiB
Vue
64 lines
2.1 KiB
Vue
<template>
|
|||
|
|
<div class="bottom-appbar w-auto mx-auto bg-white">
|
||
|
|
<div class="tabs bottom-0">
|
||
|
|
<template v-for="item in leftTabs" :key="item.id">
|
||
|
|
<div :class="navItemClass(item.routeName)" class="tab" @click="$emit('navigate', item.routeName)">
|
||
|
|
<a-badge v-if="item.routeName === 'cart'" :count="cartCount">
|
||
|
|
<Icon :icon="item.icon" size="24" />
|
||
|
|
</a-badge>
|
||
|
|
<Icon v-else :icon="item.icon" size="24" />
|
||
|
|
<div class="text-xs mt-1 font-bold">{{ item.label }}</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<div class="main_in">
|
||
|
|
<div class="text-white circle_in">
|
||
|
|
<div class="circle_into" @click="$emit('toggle-overflow')">
|
||
|
|
<img class="p-2" :src="navLogo" alt="" />
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<template v-for="item in rightTabs" :key="item.id">
|
||
|
|
<div :class="navItemClass(item.routeName)" class="tab" @click="$emit('navigate', item.routeName)">
|
||
|
|
<a-badge v-if="item.routeName === 'cart'" :count="cartCount">
|
||
|
|
<Icon :icon="item.icon" size="24" />
|
||
|
|
</a-badge>
|
||
|
|
<Icon v-else :icon="item.icon" size="24" />
|
||
|
|
<div class="text-xs mt-1 font-bold">{{ item.label }}</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="main">
|
||
|
|
<div class="circle" />
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script lang="ts" setup>
|
||
|
|
import { computed } from 'vue'
|
||
|
|
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||
|
|
import { isToken } from '@/utils'
|
||
|
|
import { useCartStore } from '@/store/cartStore'
|
||
|
|
import { getPrimaryNavItems } from '../config/navigation'
|
||
|
|
import logo from '@/assets/img/logo.png'
|
||
|
|
|
||
|
|
defineProps<{
|
||
|
|
navItemClass: (routeName: string) => string
|
||
|
|
}>()
|
||
|
|
|
||
|
|
defineEmits<{
|
||
|
|
navigate: [routeName: string]
|
||
|
|
'toggle-overflow': []
|
||
|
|
}>()
|
||
|
|
|
||
|
|
const cartStore = useCartStore()
|
||
|
|
const navLogo = logo
|
||
|
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
||
|
|
|
||
|
|
const primaryItems = computed(() => getPrimaryNavItems(isToken()))
|
||
|
|
const leftTabs = computed(() => primaryItems.value.slice(0, 2))
|
||
|
|
const rightTabs = computed(() => primaryItems.value.slice(2))
|
||
|
|
</script>
|