fix(Toast)!: rename click to onClick for consistency

This commit is contained in:
Benjamin Canac
2025-02-05 13:44:12 +01:00
parent 2c192ac145
commit 533e889589
3 changed files with 4 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ function addToast() {
add({
id,
...template,
click(toast) {
onClick(toast) {
console.log(`Toast ${toast.id} clicked`)
}
})

View File

@@ -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)"
/>
<ToastPortal :disabled="!portal">

View File

@@ -4,7 +4,7 @@ import type { ToastProps } from '../types'
export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
id: string | number
click?: (toast: Toast) => void
onClick?: (toast: Toast) => void
}
export function useToast() {