Badge.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <v-card @hover="onHover">
  3. <div class="frame">
  4. <v-img
  5. :src="img"
  6. :alt="title"
  7. :width="24"
  8. />
  9. <div class="details">
  10. <v-card-title :class="small ? 'small' : ''">{{ title }}</v-card-title>
  11. <v-card-subtitle v-if="subtitle">{{ subtitle }}</v-card-subtitle>
  12. </div>
  13. <!-- <v-card-actions>-->
  14. <!-- <v-btn icon="fas fa-plus" variant="flat" @click="onMoreClick" />-->
  15. <!-- </v-card-actions>-->
  16. </div>
  17. </v-card>
  18. </template>
  19. <script setup lang="ts">
  20. import type { PropType } from '@vue/runtime-core'
  21. import type { Ref } from '@vue/reactivity'
  22. defineProps({
  23. title: {
  24. type: String,
  25. required: true
  26. },
  27. img: {
  28. type: String,
  29. required: true
  30. },
  31. subtitle: {
  32. type: String as PropType<string | null>,
  33. required: false,
  34. default: null
  35. },
  36. details: {
  37. type: String as PropType<string | null>,
  38. required: false,
  39. default: null
  40. },
  41. small: {
  42. type: Boolean,
  43. required: false,
  44. defualt: false
  45. }
  46. })
  47. const expanded: Ref<boolean> = ref(false)
  48. const onHover = () => {
  49. }
  50. const onMoreClick = () => {
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .v-card {
  55. height: 62px;
  56. width: 95%;
  57. padding: 10px;
  58. .frame {
  59. height: 42px;
  60. display: flex;
  61. flex-direction: row;
  62. justify-content: space-between;
  63. align-items: center;
  64. flex-wrap: nowrap;
  65. max-height: 100%;
  66. }
  67. .details {
  68. flex: 1;
  69. max-width: 154px;
  70. }
  71. .v-img {
  72. max-width: 24px;
  73. height: 24px;
  74. width: 24px;
  75. margin: 4px auto;
  76. :deep(.v-img__img--contain) {
  77. display: block !important;
  78. }
  79. }
  80. .v-card-title {
  81. font-size: 15px;
  82. padding: 0 16px;
  83. font-weight: 300;
  84. line-height: 18px;
  85. white-space: break-spaces;
  86. }
  87. .v-card-title.small {
  88. font-size: 14px;
  89. line-height: 16px;
  90. }
  91. .v-card-subtitle {
  92. font-size: 13px;
  93. }
  94. }
  95. .v-card-actions {
  96. width: 24px;
  97. right: 0;
  98. padding: 0 8px;
  99. .v-btn {
  100. width: 24px;
  101. font-size: 13px;
  102. color: rgb(var(--v-theme-primary));
  103. }
  104. }
  105. //.v-card-actions {
  106. // display: none;
  107. //}
  108. //
  109. //.v-card:hover {
  110. // .v-card-actions {
  111. // display: block;
  112. // }
  113. //}
  114. </style>