LinkList.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div class="inner--link--contents">
  3. <ul>
  4. <li v-for="(item, index) in links" :key="index">
  5. <NuxtLink :to="item.url" :target="item.target || '_self'" :class="item.class">
  6. {{ item.text }}
  7. <svg
  8. v-if="item.showIcon !== false"
  9. width="24"
  10. height="24"
  11. aria-label="New Tab"
  12. xmlns="http://www.w3.org/2000/svg"
  13. stroke="#fff"
  14. data-testid="link-icon"
  15. >
  16. <title>New Tab</title>
  17. <path
  18. d="M17.5 11.594V20.5h-15v-15h7.969m4.031-3h6v6m-9 3 9-9-9 9Z"
  19. stroke="#fff"
  20. fill="none"
  21. ></path>
  22. </svg>
  23. </NuxtLink>
  24. </li>
  25. </ul>
  26. </div>
  27. </template>
  28. <script setup>
  29. // Props 정의
  30. const props = defineProps({
  31. links: {
  32. type: Array,
  33. required: true,
  34. default: () => [],
  35. validator: (value) => {
  36. // 각 링크 객체가 필수 속성을 가지고 있는지 확인
  37. return value.every(
  38. (link) => link.hasOwnProperty("text") && link.hasOwnProperty("url")
  39. );
  40. },
  41. },
  42. });
  43. // 링크 데이터 구조 예시:
  44. // [
  45. // {
  46. // text: "Q8 50 TDI quattro exclusive edition 예약금 결제",
  47. // url: "/reservation/q8",
  48. // target: "_blank", // 선택사항, 기본값: "_self"
  49. // showIcon: true, // 선택사항, 기본값: true
  50. // class: "custom-class" // 선택사항
  51. // },
  52. // {
  53. // text: "RS 6 Avant 예약금 결제",
  54. // url: "/reservation/rs6",
  55. // target: "_self",
  56. // showIcon: false
  57. // }
  58. // ]
  59. </script>