84 lines
2.4 KiB
Vue
84 lines
2.4 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)">
|
|
<div class="tab__icon">
|
|
<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>
|
|
<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)">
|
|
<div class="tab__icon">
|
|
<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>
|
|
<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>
|
|
|
|
<style scoped>
|
|
.tab__icon {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 24px;
|
|
height: 24px;
|
|
flex-shrink: 0;
|
|
color: inherit;
|
|
}
|
|
|
|
.tab__icon :deep(.ant-badge) {
|
|
color: inherit;
|
|
}
|
|
</style>
|