Badge.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <v-card @hover="onHover">
  3. <div class="frame">
  4. <v-img
  5. :src="img"
  6. :alt="title"
  7. />
  8. <div>
  9. <v-card-title>{{ title }}</v-card-title>
  10. <v-card-subtitle v-if="subtitle">{{ subtitle }}</v-card-subtitle>
  11. <v-card-text v-if="details && expanded">{{ details }}</v-card-text>
  12. <v-card-actions v-if="details && !expanded">
  13. <v-btn icon="fas fa-plus" variant="flat" @click="onMoreClick" />
  14. </v-card-actions>
  15. </div>
  16. </div>
  17. </v-card>
  18. </template>
  19. <script setup lang="ts">
  20. import type { PropType } from '@vue/runtime-core'
  21. defineProps({
  22. title: {
  23. type: String,
  24. required: true
  25. },
  26. img: {
  27. type: String,
  28. required: true
  29. },
  30. subtitle: {
  31. type: String as PropType<string | null>,
  32. required: false,
  33. default: null
  34. },
  35. details: {
  36. type: String as PropType<string | null>,
  37. required: false,
  38. default: null
  39. },
  40. })
  41. const expanded: Ref<boolean> = ref(false)
  42. const onMoreClick = () => {
  43. }
  44. </script>
  45. <style scoped lang="scss">
  46. .v-card {
  47. height: 96px;
  48. width: 196px;
  49. padding: 10px;
  50. .frame {
  51. display: flex;
  52. flex-direction: row;
  53. justify-content: space-between;
  54. align-items: center;
  55. flex-wrap: nowrap;
  56. max-height: 100%;
  57. }
  58. .v-img {
  59. height: 32px;
  60. }
  61. }
  62. .v-card-actions {
  63. display: none;
  64. }
  65. .v-card:hover {
  66. .v-card-actions {
  67. display: block;
  68. }
  69. }
  70. </style>