TagCloud.vue 482 B

1234567891011121314151617181920212223242526272829
  1. <script setup lang="ts">
  2. import type { Tag } from '@/models'
  3. import TagCard from '@/components/TagCard.vue'
  4. const props = defineProps<{
  5. tags: Tag[]
  6. onClick?: (tag: Tag) => void
  7. }>()
  8. function handleClick(tag: Tag) {
  9. if (props.onClick) {
  10. props.onClick(tag)
  11. }
  12. }
  13. </script>
  14. <template>
  15. <div>
  16. <TagCard
  17. v-for="tag in props.tags"
  18. :key="tag.id"
  19. :target="tag"
  20. :on-click="() => handleClick(tag)"
  21. />
  22. </div>
  23. </template>
  24. <style scoped></style>