Card.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!--
  2. Container de type Card
  3. -->
  4. <template>
  5. <v-card
  6. elevation="2"
  7. outlined
  8. shaped
  9. min-height="200"
  10. >
  11. <v-card-title>
  12. <slot name="card.title" />
  13. </v-card-title>
  14. <v-card-text>
  15. <slot name="card.text" />
  16. </v-card-text>
  17. <v-card-actions>
  18. <v-spacer />
  19. <v-btn icon>
  20. <NuxtLink :to="link" class="no-decoration">
  21. <v-icon>mdi-pencil</v-icon>
  22. </NuxtLink>
  23. </v-btn>
  24. <UiButtonDelete v-if="canDelete" :delete-args="args" />
  25. <slot name="card.action" />
  26. </v-card-actions>
  27. </v-card>
  28. </template>
  29. <script lang="ts">
  30. import { defineComponent } from '@nuxtjs/composition-api'
  31. import { QUERY_TYPE } from '~/types/enums'
  32. import { DataDeleterArgs } from '~/types/interfaces'
  33. export default defineComponent({
  34. props: {
  35. link: {
  36. type: String,
  37. required: true
  38. },
  39. model: {
  40. type: Function,
  41. required: true
  42. },
  43. id: {
  44. type: Number,
  45. required: true
  46. },
  47. canDelete:{
  48. type: Boolean,
  49. required: false,
  50. default: true
  51. }
  52. },
  53. setup (props) {
  54. const args: DataDeleterArgs = {
  55. type: QUERY_TYPE.MODEL,
  56. model: props.model,
  57. id: props.id
  58. }
  59. return {
  60. args
  61. }
  62. }
  63. })
  64. </script>
  65. <style scoped>
  66. </style>