Spaces:
Paused
Paused
File size: 703 Bytes
730b0a8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<script setup lang="ts">
import { useDrag } from 'vue3-dnd'
import { ItemTypes } from './ItemTypes'
import { toRefs } from '@vueuse/core'
import ItemCard from "@/components/ItemCard.vue";
const props = defineProps<{
emoji: string
title: string
}>()
const [collect, drag] = useDrag(() => ({
type: ItemTypes.BOX,
item: { title: props.title, emoji: props.emoji },
collect: monitor => ({
isDragging: monitor.isDragging(),
}),
}))
const { isDragging } = toRefs(collect)
</script>
<template>
<div
class="inline-block"
:ref="drag"
role="Box"
data-testid="box"
>
<ItemCard :title="title" :emoji="emoji"></ItemCard>
</div>
</template>
<style scoped>
</style> |