Files
front/components/CardPreview.vue
T
2024-04-20 15:04:32 +02:00

39 lines
662 B
Vue

<script setup lang="ts">
export interface Props {
data?: string
}
const props = defineProps<Props>()
const cards = useState<{ [key: string]: any }>('cards')
function cardClick() {
if (!props.data) return
console.log(JSON.parse(JSON.stringify(cards.value[props.data].effects)))
}
</script>
<template>
<span class="card">
<span v-if="props.data" @click="cardClick">
{{ cards[props.data]?.name }}
</span>
<span v-if="props.data === null">
HIDDEN
</span>
<slot></slot>
</span>
</template>
<style scoped>
.card {
border: 1px solid black;
cursor: pointer
}
</style>