Initial commit: Vuelato - buscador de vuelos
Some checks failed
ci / ci (22, ubuntu-latest) (push) Has been cancelled
Some checks failed
ci / ci (22, ubuntu-latest) (push) Has been cancelled
Nuxt 4 + Supabase + Flightics API. Incluye búsqueda de vuelos, inspiraciones, watchlist, tracking de precios y mapa interactivo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
app/components/detail/ShareButton.vue
Normal file
31
app/components/detail/ShareButton.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
title: string
|
||||
price: number
|
||||
}>()
|
||||
|
||||
const copied = ref(false)
|
||||
|
||||
async function share() {
|
||||
const url = window.location.href
|
||||
const text = `${props.title} - ${props.price.toFixed(0)}€`
|
||||
|
||||
if (navigator.share) {
|
||||
await navigator.share({ title: text, url })
|
||||
} else {
|
||||
await navigator.clipboard.writeText(`${text}\n${url}`)
|
||||
copied.value = true
|
||||
setTimeout(() => { copied.value = false }, 2000)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UButton
|
||||
:label="copied ? 'Copiado!' : 'Compartir'"
|
||||
:icon="copied ? 'i-lucide-check' : 'i-lucide-share-2'"
|
||||
:color="copied ? 'success' : 'neutral'"
|
||||
variant="outline"
|
||||
@click="share"
|
||||
/>
|
||||
</template>
|
||||
Reference in New Issue
Block a user