From 2ac9bbf2206501d6b10d6b9fdd09189607781e9b Mon Sep 17 00:00:00 2001 From: Oscar Date: Tue, 9 Jun 2026 15:39:00 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(src/views/dev/TestView.vue):?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=81=D0=B1=D1=80=D0=BE=D1=81=D0=B0=20=D1=84=D0=BB=D0=BE?= =?UTF-8?q?=D1=83=20=D0=BB=D0=B0=D0=B9=D0=BA=D0=BE=D0=B2,=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D1=87=D0=B5=D0=B9=20=D0=B8=20=D1=87=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ feat(src/composables/useUi.ts): добавляет возможность действия для уведомлений в тостах --- src/composables/useUi.ts | 7 +- src/views/dev/TestView.vue | 458 +++++++++++++++++++++++++++++++++++++ 2 files changed, 462 insertions(+), 3 deletions(-) create mode 100644 src/views/dev/TestView.vue diff --git a/src/composables/useUi.ts b/src/composables/useUi.ts index 904202f..c12e35b 100644 --- a/src/composables/useUi.ts +++ b/src/composables/useUi.ts @@ -8,6 +8,7 @@ export interface Toast { type: ToastType message: string duration?: number + action?: { label: string, onClick: () => void } } export type Tag = TagResponseDto @@ -16,16 +17,16 @@ export type District = DistrictResponseDto export type Greeting = GreetingDto const toasts = ref([]) -const sidebarExpanded = ref(false) +const sidebarExpanded = ref(true) const tags = ref([]) const cities = ref([]) const districts = reactive>({}) const greetings = ref([]) const referencesLoaded = ref(false) -function addToast(message: string, type: ToastType = 'info', duration = 4000) { +function addToast(message: string, type: ToastType = 'info', duration = 4000, action?: Toast['action']) { const id = `${Date.now()}-${Math.random()}` - toasts.value.push({ id, type, message, duration }) + toasts.value.push({ id, type, message, duration, action }) if (duration > 0) { setTimeout(removeToast, duration, id) } diff --git a/src/views/dev/TestView.vue b/src/views/dev/TestView.vue new file mode 100644 index 0000000..65d7d73 --- /dev/null +++ b/src/views/dev/TestView.vue @@ -0,0 +1,458 @@ + + + + +