모달수정

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(() => {
return toastStore.toastType === 'error' ? 'bg-danger' : 'bg-success'; // red, blue
return toastStore.toastType === 'e' ? 'bg-danger' : 'bg-success'; // red, blue
});
</script>

View File

@ -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';
},
},
});