모달수정
This commit is contained in:
parent
1f8b4267ee
commit
e9dda8cbea
@ -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>
|
||||
|
||||
|
||||
@ -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';
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user