faq.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div>
  3. <topVisual />
  4. <div class="sub-content">
  5. <div class="container">
  6. <h2 class="sub-title">자주 묻는 질문</h2>
  7. <div class="faq-list">
  8. <div v-for="(item, index) in faqItems" :key="index" class="faq-item">
  9. <div class="faq-question" @click="toggleAnswer(index)">
  10. <span class="q-mark">Q</span>
  11. <span class="question-text">{{ item.question }}</span>
  12. <span class="toggle-icon" :class="{ active: openIndex === index }">▼</span>
  13. </div>
  14. <div v-if="openIndex === index" class="faq-answer">
  15. <span class="a-mark">A</span>
  16. <span class="answer-text">{{ item.answer }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup>
  25. import topVisual from '~/components/topVisual.vue';
  26. const openIndex = ref(null);
  27. const faqItems = [
  28. {
  29. question: '그린웨일글로벌의 주요 제품은 무엇인가요?',
  30. answer: '친환경 소재와 지속 가능한 솔루션을 제공합니다.'
  31. },
  32. {
  33. question: '제품 문의는 어떻게 하나요?',
  34. answer: '고객지원 페이지의 문의 양식을 통해 문의하실 수 있습니다.'
  35. },
  36. {
  37. question: '기술 지원을 받을 수 있나요?',
  38. answer: '네, 전문 기술진이 상담 및 지원을 제공합니다.'
  39. }
  40. ];
  41. const toggleAnswer = (index) => {
  42. openIndex.value = openIndex.value === index ? null : index;
  43. };
  44. </script>
  45. <style scoped>
  46. .faq-list {
  47. padding: 40px 0;
  48. }
  49. .faq-item {
  50. border-bottom: 1px solid #e0e0e0;
  51. padding: 20px 0;
  52. }
  53. .faq-question {
  54. display: flex;
  55. align-items: center;
  56. cursor: pointer;
  57. padding: 10px 0;
  58. }
  59. .q-mark, .a-mark {
  60. display: inline-flex;
  61. align-items: center;
  62. justify-content: center;
  63. width: 30px;
  64. height: 30px;
  65. background: #00a651;
  66. color: white;
  67. border-radius: 50%;
  68. margin-right: 15px;
  69. font-weight: bold;
  70. }
  71. .a-mark {
  72. background: #666;
  73. }
  74. .question-text {
  75. flex: 1;
  76. font-size: 18px;
  77. font-weight: 500;
  78. }
  79. .toggle-icon {
  80. transition: transform 0.3s;
  81. }
  82. .toggle-icon.active {
  83. transform: rotate(180deg);
  84. }
  85. .faq-answer {
  86. display: flex;
  87. align-items: flex-start;
  88. padding: 20px 0;
  89. background: #f8f8f8;
  90. margin-top: 10px;
  91. padding: 20px;
  92. border-radius: 4px;
  93. }
  94. .answer-text {
  95. flex: 1;
  96. font-size: 16px;
  97. line-height: 1.6;
  98. }
  99. </style>