Refine catalog cart controls and show cart badge in header

This commit is contained in:
Ruslan Bakiev
2026-04-03 08:50:24 +07:00
parent 4f14c24e46
commit 0f7787de36
3 changed files with 39 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ type NavItem = {
};
const route = useRoute();
const { totalItems } = useClientCart();
const leftCapsule: NavItem[] = [
{ to: '/profile', label: 'Профиль', icon: 'user' },
@@ -83,6 +84,9 @@ function isActive(path: string) {
<path d="M7 4h-2l-1 2v2h1l2.2 9h10.6l2.2-7H8.3L7.8 8H21V6h-12l-1-2Zm2 16a2 2 0 1 0 0 .01V20Zm8 0a2 2 0 1 0 0 .01V20Z" fill="currentColor" />
</svg>
{{ item.label }}
<span v-if="item.to === '/cart' && totalItems > 0" class="badge badge-sm border-0 bg-[#139957] text-white">
{{ totalItems }}
</span>
</NuxtLink>
</div>
</div>