Skip to content

Events

@click

The @click event is triggered when the user clicks on a photo.

Type

Event NameHandler TypePayload Type
clickPhotoClickHandlerPhotoClickPayload
ts
type PhotoClickHandler = (payload: PhotoClickPayload) => void

type PhotoClickPayload = {
  event: MouseEvent
  photo: Photo
  index: number
}

Usage

vue
<script setup lang="ts">
const onClick: PhotoClickHandler = (payload) => {
  console.log(payload)
}
</script>

<template>
  <PhotoAlbum @click="onClick" />
</template>

Example

No photo has been clicked yet, try it! 👇