diff --git a/playground/app/pages/components/toast.vue b/playground/app/pages/components/toast.vue index afe01c60..4c3aa64a 100644 --- a/playground/app/pages/components/toast.vue +++ b/playground/app/pages/components/toast.vue @@ -98,7 +98,7 @@ function addToast() { add({ id, ...template, - click(toast) { + onClick(toast) { console.log(`Toast ${toast.id} clicked`) } }) diff --git a/src/runtime/components/Toaster.vue b/src/runtime/components/Toaster.vue index d853d40a..e63f1850 100644 --- a/src/runtime/components/Toaster.vue +++ b/src/runtime/components/Toaster.vue @@ -121,10 +121,10 @@ function getOffset(index: number) { '--transform': 'translateY(var(--translate)) scale(var(--scale))' }" :class="[ui.base(), { - 'cursor-pointer': !!toast.click + 'cursor-pointer': !!toast.onClick }]" @update:open="onUpdateOpen($event, toast.id)" - @click="toast.click && toast.click(toast)" + @click="toast.onClick && toast.onClick(toast)" /> diff --git a/src/runtime/composables/useToast.ts b/src/runtime/composables/useToast.ts index 0c4d8de7..7c895e48 100644 --- a/src/runtime/composables/useToast.ts +++ b/src/runtime/composables/useToast.ts @@ -4,7 +4,7 @@ import type { ToastProps } from '../types' export interface Toast extends Omit { id: string | number - click?: (toast: Toast) => void + onClick?: (toast: Toast) => void } export function useToast() {