모달수정

This commit is contained in:
khj0414 2025-01-10 15:21:47 +09:00
parent 1f8b4267ee
commit e9dda8cbea
2 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ const offToast = () => {
}; };
const toastClass = computed(() => { const toastClass = computed(() => {
return toastStore.toastType === 'error' ? 'bg-danger' : 'bg-success'; // red, blue return toastStore.toastType === 'e' ? 'bg-danger' : 'bg-success'; // red, blue
}); });
</script> </script>

View File

@ -5,14 +5,14 @@ export const useToastStore = defineStore('toastStore', {
toastModal: false, toastModal: false,
toastMsg: '', toastMsg: '',
time: 2000, time: 2000,
toastType: 'success', // 'success' 또는 'error' toastType: 's',
}), }),
actions: { actions: {
onToast(msg = '', time = 2000, type = 'success') { onToast(msg = '', type = 's', time = 2000) {
this.toastModal = true; this.toastModal = true;
this.toastMsg = msg; this.toastMsg = msg;
this.time = time;
this.toastType = type; this.toastType = type;
this.time = time;
// 시간이 지난 후 토스트 숨기기 // 시간이 지난 후 토스트 숨기기
setTimeout(() => { setTimeout(() => {
@ -22,7 +22,7 @@ export const useToastStore = defineStore('toastStore', {
offToast() { offToast() {
this.toastModal = false; this.toastModal = false;
this.toastMsg = ''; this.toastMsg = '';
this.toastType = 'success'; // 기본 상태로 초기화 this.toastType = 's';
}, },
}, },
}); });