index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <script setup lang="ts">
  2. import ArrowRight from '@/assets/icons/arrow-right.svg'
  3. defineProps({
  4. title: {
  5. type: String,
  6. required: true
  7. },
  8. image: {
  9. type: String,
  10. required: true
  11. },
  12. details: {
  13. type: Array as () => string[],
  14. default: () => []
  15. },
  16. link: {
  17. type: String,
  18. default: '#'
  19. }
  20. })
  21. </script>
  22. <template>
  23. <div class="product-card">
  24. <img :src="image" :alt="title">
  25. <div class="product-info">
  26. <h4>{{ title }}</h4>
  27. <div class="product-details">
  28. <div v-for="(detail, index) in details" :key="index">{{ detail }}</div>
  29. </div>
  30. <a v-if="link" :href="link" class="learn-more">
  31. 了解更多
  32. <img :src="ArrowRight" alt="arrow right" class="arrow-icon">
  33. </a>
  34. </div>
  35. </div>
  36. </template>
  37. <style lang="scss" scoped>
  38. .product-card {
  39. background: white;
  40. padding: 20px;
  41. border-radius: 4px;
  42. display: flex;
  43. gap: 20px;
  44. img {
  45. width: 64px;
  46. height: 64px;
  47. object-fit: contain;
  48. }
  49. .product-info {
  50. flex: 1;
  51. h4 {
  52. margin-bottom: 12px;
  53. font-size: 18px;
  54. }
  55. .product-details {
  56. font-size: 14px;
  57. line-height: 1.6;
  58. color: rgba(0, 0, 0, 0.65);
  59. }
  60. .learn-more {
  61. display: inline-flex;
  62. align-items: center;
  63. gap: 8px;
  64. color: #0070D5;
  65. text-decoration: none;
  66. margin-top: 12px;
  67. font-size: 14px;
  68. .arrow-icon {
  69. width: 5px;
  70. height: 10px;
  71. }
  72. &:hover {
  73. text-decoration: underline;
  74. }
  75. }
  76. }
  77. }
  78. </style>