From 399f81e35a644aeb594d4983d693c500baf8f1d0 Mon Sep 17 00:00:00 2001 From: 25Ericcheong Date: Sat, 18 May 2024 17:45:04 +0800 Subject: [PATCH 1/3] feat: Finished menu feature --- src/components/menu/bingsu-menu-modal.vue | 13 ++- src/components/menu/drinks-menu-modal.vue | 5 +- src/components/menu/menu.vue | 2 +- src/components/menu/summary-menu-modal.vue | 108 ++++++++++++++++++--- src/stores/useMenuStore.ts | 34 +++++-- 5 files changed, 135 insertions(+), 27 deletions(-) diff --git a/src/components/menu/bingsu-menu-modal.vue b/src/components/menu/bingsu-menu-modal.vue index ff5675a..6d781a1 100644 --- a/src/components/menu/bingsu-menu-modal.vue +++ b/src/components/menu/bingsu-menu-modal.vue @@ -4,7 +4,7 @@ import { useMenuStore, type CartItemBingsu, } from "@/stores/useMenuStore"; -import { computed, ref } from "vue"; +import { computed, ref, watch } from "vue"; import { MenuItemType } from "./menu-item-type"; import { MENU, OAT_MILK } from "./menu-items"; @@ -116,10 +116,19 @@ const shouldDisableConfirmationButton = computed(() => { }); function handleBingsuConfirmation() { + store.addBingsuOrder(cartItemBingsu.value); resetCartItem(); closeBinqsuMenuModal(); - store.addBingsuOrder(cartItemBingsu.value); } + +watch( + () => cartItemBingsu.value, + (cartItemBingsu) => { + // use toRaw here to get a readable console.log result + console.log(cartItemBingsu); + }, + { deep: true } +);