From e9dda8cbea8395c28e64df489d5089525c79810b Mon Sep 17 00:00:00 2001 From: khj0414 Date: Fri, 10 Jan 2025 15:21:47 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=8B=AC=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/ToastModal.vue | 2 +- src/stores/toastStore.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/modal/ToastModal.vue b/src/components/modal/ToastModal.vue index b63c13f..bf7afe2 100644 --- a/src/components/modal/ToastModal.vue +++ b/src/components/modal/ToastModal.vue @@ -32,7 +32,7 @@ const offToast = () => { }; const toastClass = computed(() => { - return toastStore.toastType === 'error' ? 'bg-danger' : 'bg-success'; // 에러일 경우 red, 정상일 경우 blue + return toastStore.toastType === 'e' ? 'bg-danger' : 'bg-success'; // 에러일 경우 red, 정상일 경우 blue }); diff --git a/src/stores/toastStore.js b/src/stores/toastStore.js index 8822951..e182216 100644 --- a/src/stores/toastStore.js +++ b/src/stores/toastStore.js @@ -4,25 +4,25 @@ export const useToastStore = defineStore('toastStore', { state: () => ({ toastModal: false, toastMsg: '', - time: 2000, - toastType: 'success', // 'success' 또는 'error' + time: 2000, + toastType: 's', }), actions: { - onToast(msg = '', time = 2000, type = 'success') { + onToast(msg = '', type = 's', time = 2000) { this.toastModal = true; this.toastMsg = msg; - this.time = time; this.toastType = type; + this.time = time; // 시간이 지난 후 토스트 숨기기 setTimeout(() => { this.offToast(); - }, this.time); + }, this.time); }, offToast() { this.toastModal = false; this.toastMsg = ''; - this.toastType = 'success'; // 기본 상태로 초기화 + this.toastType = 's'; }, }, });