notice.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <main>
  3. <TopVisual :className="className" :title="title" :navigation="navigation" />
  4. <section class="notice--section">
  5. <div class="sub--container type2">
  6. <div class="title--wrap">
  7. <h2 class="title">공지사항</h2>
  8. </div>
  9. <div class="search--wrap">
  10. <USelect v-model="searchValue" :items="searchItems" />
  11. <UInput v-model="searchKeyword" placeholder="검색어를 입력해주세요."/>
  12. <UButton class="search--btn"></UButton>
  13. </div>
  14. <div class="notice--wrap">
  15. <div class="notice--list">
  16. <NuxtLink
  17. v-for="news in paginatedNews"
  18. :key="news.id"
  19. to="/contact/noticeView"
  20. class="notice"
  21. >
  22. <span class="news--index">{{ news.id }}</span>
  23. <h4>{{ news.title }}</h4>
  24. <span class="news--date">{{ news.date }}</span>
  25. </NuxtLink>
  26. </div>
  27. <div class="pagination--wrap">
  28. <UButton
  29. @click="prevPage"
  30. class="prev--btn"
  31. :disabled="currentPage === 1"
  32. ></UButton>
  33. <div class="numbs">
  34. <UButton
  35. v-for="page in totalPages"
  36. :key="page"
  37. @click="goToPage(page)"
  38. :class="{ 'active': currentPage === page }"
  39. >
  40. {{ page }}
  41. </UButton>
  42. </div>
  43. <UButton
  44. @click="nextPage"
  45. class="next--btn"
  46. :disabled="currentPage === totalPages"
  47. ></UButton>
  48. </div>
  49. </div>
  50. </div>
  51. </section>
  52. </main>
  53. </template>
  54. <script setup>
  55. import TopVisual from '~/components/topVisual.vue';
  56. const searchItems = ref(['제목'])
  57. const searchValue = ref('선택')
  58. const searchKeyword = ref('')
  59. const className = ref("contact")
  60. const title = ref("Contact")
  61. const navigation = ref([
  62. { name: "Contact",
  63. link: "/contact/notice" ,
  64. gnbList: [
  65. { name: "공지사항", link: "/contact/notice" },
  66. { name: "FAQ", link: "/contact/faq" },
  67. { name: "고객센터", link: "/contact/support" },
  68. { name: "오시는길", link: "/contact/location" }
  69. ]
  70. },
  71. { name: "공지사항", link: "/contact/notice" }
  72. ])
  73. // 뉴스 데이터 배열 생성
  74. const newsData = ref([
  75. { id: 1, title: "그린플라스틱연합, ESG친환경대전서 '자원순환 탄소중립 GPA 컨퍼런스' 개최", date: "2025.07.11", image: "/img/img--news.png", link: "/" },
  76. { id: 2, title: "친환경 플라스틱 기술 개발 동향", date: "2025.07.10", image: "/img/img--cycle--center.png", link: "/" },
  77. { id: 3, title: "탄소중립 실현을 위한 플라스틱 재활용 기술", date: "2025.07.09", image: "/img/img--cycle--center.png", link: "/" },
  78. { id: 4, title: "바이오플라스틱 시장 전망과 기술 동향", date: "2025.07.08", image: "/img/img--cycle--center.png", link: "/" },
  79. { id: 5, title: "플라스틱 감축을 위한 정부 정책 변화", date: "2025.07.07", image: "/img/img--cycle--center.png", link: "/" },
  80. { id: 6, title: "순환경제와 플라스틱 재활용 산업", date: "2025.07.06", image: "/img/img--cycle--center.png", link: "/" },
  81. { id: 7, title: "해양 플라스틱 오염 해결을 위한 혁신 기술", date: "2025.07.05", image: "/img/img--cycle--center.png", link: "/" },
  82. { id: 8, title: "친환경 포장재 개발 현황", date: "2025.07.04", image: "/img/img--cycle--center.png", link: "/" },
  83. { id: 9, title: "플라스틱 대체재 소재 연구 동향", date: "2025.07.03", image: "/img/img--cycle--center.png", link: "/" },
  84. { id: 10, title: "ESG 경영과 플라스틱 감축 전략", date: "2025.07.02", image: "/img/img--cycle--center.png", link: "/" },
  85. { id: 11, title: "글로벌 플라스틱 규제 동향", date: "2025.07.01", image: "/img/img--cycle--center.png", link: "/" },
  86. { id: 12, title: "생분해성 플라스틱 상용화 전망", date: "2025.06.30", image: "/img/img--cycle--center.png", link: "/" },
  87. { id: 13, title: "플라스틱 없는 일주일 캠페인", date: "2025.06.29", image: "/img/img--cycle--center.png", link: "/" },
  88. { id: 14, title: "재활용 플라스틱 품질 향상 기술", date: "2025.06.28", image: "/img/img--cycle--center.png", link: "/" },
  89. { id: 15, title: "플라스틱 순환경제 구축 방안", date: "2025.06.27", image: "/img/img--cycle--center.png", link: "/" },
  90. { id: 16, title: "친환경 소재 개발 투자 확대", date: "2025.06.26", image: "/img/img--cycle--center.png", link: "/" },
  91. { id: 17, title: "마이크로플라스틱 저감 기술", date: "2025.06.25", image: "/img/img--cycle--center.png", link: "/" },
  92. { id: 18, title: "플라스틱 재활용률 제고 방안", date: "2025.06.24", image: "/img/img--cycle--center.png", link: "/" },
  93. { id: 19, title: "바이오매스 기반 플라스틱 개발", date: "2025.06.23", image: "/img/img--cycle--center.png", link: "/" },
  94. { id: 20, title: "환경친화적 플라스틱 산업 전망", date: "2025.06.22", image: "/img/img--cycle--center.png", link: "/" },
  95. { id: 21, title: "플라스틱 폐기물 감축 정책", date: "2025.06.21", image: "/img/img--cycle--center.png", link: "/" },
  96. { id: 22, title: "지속가능한 포장재 솔루션", date: "2025.06.20", image: "/img/img--cycle--center.png", link: "/" },
  97. { id: 23, title: "플라스틱 리사이클링 혁신 기술", date: "2025.06.19", image: "/img/img--cycle--center.png", link: "/" },
  98. { id: 24, title: "친환경 플라스틱 인증 시스템", date: "2025.06.18", image: "/img/img--cycle--center.png", link: "/" },
  99. { id: 25, title: "탄소 발자국 감축을 위한 플라스틱 대안", date: "2025.06.17", image: "/img/img--cycle--center.png", link: "/" }
  100. ])
  101. // 페이지네이션 로직
  102. const currentPage = ref(1)
  103. const itemsPerPage = 10
  104. const totalPages = computed(() => Math.ceil(newsData.value.length / itemsPerPage))
  105. const paginatedNews = computed(() => {
  106. const start = (currentPage.value - 1) * itemsPerPage
  107. const end = start + itemsPerPage
  108. return newsData.value.slice(start, end)
  109. })
  110. const goToPage = (page) => {
  111. if (page >= 1 && page <= totalPages.value) {
  112. currentPage.value = page
  113. }
  114. }
  115. const nextPage = () => {
  116. if (currentPage.value < totalPages.value) {
  117. currentPage.value++
  118. }
  119. }
  120. const prevPage = () => {
  121. if (currentPage.value > 1) {
  122. currentPage.value--
  123. }
  124. }
  125. </script>