mainVisual.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="main--visual">
  3. <!-- Video -->
  4. <div v-if="type === 'video'" class="video--wrap">
  5. <video :src="src" autoplay muted loop playsinline controls></video>
  6. </div>
  7. <!-- Image -->
  8. <div v-else-if="type === 'image'" class="img--wrap">
  9. <img :src="src" :alt="title" />
  10. </div>
  11. <div class="text--wrap">
  12. <h2>{{ title }}</h2>
  13. <p>{{ description }}</p>
  14. <div v-if="button1Title || button2Title" class="button--wrap">
  15. <NuxtLink
  16. v-if="button1Title"
  17. :to="button1Link"
  18. :class="['btn', `btn--${button1Color}`]"
  19. >
  20. {{ button1Title }}
  21. </NuxtLink>
  22. <NuxtLink
  23. v-if="button2Title"
  24. :to="button2Link"
  25. :class="['btn', `btn--${button2Color}`]"
  26. >
  27. {{ button2Title }}
  28. </NuxtLink>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script setup>
  34. defineProps({
  35. type: {
  36. type: String,
  37. default: 'video',
  38. validator: (value) => ['video', 'image'].includes(value)
  39. },
  40. src: {
  41. type: String,
  42. required: true
  43. },
  44. title: {
  45. type: String,
  46. default: ''
  47. },
  48. description: {
  49. type: String,
  50. default: ''
  51. },
  52. button1Title: {
  53. type: String,
  54. default: ''
  55. },
  56. button1Link: {
  57. type: String,
  58. default: '#'
  59. },
  60. button1Color: {
  61. type: String,
  62. default: 'black',
  63. validator: (value) => ['black', 'gray'].includes(value)
  64. },
  65. button2Title: {
  66. type: String,
  67. default: ''
  68. },
  69. button2Link: {
  70. type: String,
  71. default: '#'
  72. },
  73. button2Color: {
  74. type: String,
  75. default: 'gray',
  76. validator: (value) => ['black', 'gray'].includes(value)
  77. }
  78. });
  79. </script>