Syw.Frontend

๐Ÿงฉ Vue 2๋กœ ๋ฐฐ์šฐ๋Š” ํ”„๋ก ํŠธ์—”๋“œ ๊ธฐ์ดˆ

2๋‹จ๊ณ„. ๋„ฅ์ŠคํŠธ๊ณต๋ฌด์› ๋ฉ”์ธ Vue + Express๋กœ ๋กœ ํด๋ก ํ•˜๊ธฐ

2-7. ํ€ต๋ฉ”๋‰ด ์ขŒ์ธก ์˜์—ญ ๊ตฌํ˜„

โœ… LeftQuickMenu.vue

<template>
  <div class="left-quickmenu">
    <!-- โœ… ์ƒ๋‹จ 1ํƒ€ ๋ฐฐ๋„ˆ ์Šฌ๋ผ์ด๋“œ -->
    <swiper :options="topSwiperOption" class="tea-swiper">
      <swiper-slide v-for="(banner, index) in teaItems" :key="index">
        <div class="quick-banner teacher-banner">
          <img :src="banner.img" alt="์ƒ๋‹จ ๋ฐฐ๋„ˆ" />
        </div>
      </swiper-slide>
      <div class="swiper-pagination top-pagination" slot="pagination"></div>
    </swiper>

    <!-- โœ… ๊ฐ€์šด๋ฐ ๋ฉ”๊ฐ€ํฐ -->
    <div class="quick-banner megaphone-banner">
      <img src="https://img.megagong.net/m/2025/0703_notice/bn_left_sky.png" alt="megaphone" />
    </div>

    <!-- โœ… ํ•˜๋‹จ OX ํ€ด์ฆˆ - Swiper -->
    <swiper :options="quizSwiperOption" class="ox-swiper">
      <swiper-slide v-for="(quiz, index) in quizItems" :key="index">
        <div class="quick-banner quiz-banner">
          <img :src="quiz.img" alt="ํ€ด์ฆˆ ๋ฐฐ๋„ˆ" />
        </div>
      </swiper-slide>
      <div class="swiper-pagination ox-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import "swiper/css/swiper.css";

export default {
  name: "LeftQuickMenu",
  data() {
    return {
      teaItems: [
        {
          img: "https://img.megagong.net/m/2025/0710_allawyer/left_sky_bn_gong.png",
        },
        {
          img: "https://img.megagong.net/m/2025/0714_tjenglish08/con_img31.png",
        },
      ],
      quizItems: [
        {
          img: "https://img.megagong.net/m/2025/0625_next/side_left_1_4.png",
        },
        {
          img: "https://img.megagong.net/m/2025/0512_main/side_left_1_2.png",
        },
      ],
      topSwiperOption: {
        slidesPerView: 1,
        loop: true,
        autoplay: {
          delay: 3500,
          disableOnInteraction: false,
        },
        pagination: {
          el: ".top-pagination",
          clickable: true,
        },
      },
      quizSwiperOption: {
        slidesPerView: 1,
        loop: true,
        autoplay: {
          delay: 3000,
          disableOnInteraction: false,
        },
        pagination: {
          el: ".ox-pagination",
          clickable: true,
        },
      },
    };
  },
};
</script>

<style scoped lang="scss">
.left-quickmenu {
  position: absolute;
  top: 40px;
  right: 50%;
  margin-right: 630px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 106px;
  z-index: 99;
}

.quick-banner {
  width: 100%;

  img {
    width: 100%;
    border-radius: 12px;
  }

  .text {
    font-size: 12px;
    color: #222;
    line-height: 1.4;

    strong {
      font-weight: bold;
      color: #0070f3;
    }
  }
}

.tea-swiper,
.ox-swiper {
  width: 106px;
}
</style>

โœ… src/components/RightQuickMenu.vue

์ขŒ์ธก ํ€ต๋ฉ”๋‰ด ๋„ˆ๋น„์— ๋งž์ถฐ์„œ ์šฐ์ธก ํ€ต๋ฉ”๋‰ด ๋„ˆ๋น„๋„ ์กฐ์ •ํ•ด์ค๋‹ˆ๋‹ค.

<style lang="scss" scoped>
.right-quick-menu {
  position: absolute;
  top: 40px;
  left: 50%;
  margin-left: 630px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 99;
  width: 106px;
}

.quick-card {
  width: 100%;
  padding: 10px 5px;
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid #ddd;
  background: #fff;
}

/* ์ƒ๋žต */
</style>

GitHub - heroyooi/vue2-megagong at ch7

์ด์ œ ์ „๋ฐ˜์ ์ธ ๋„ฅ์ŠคํŠธ๊ณต๋ฌด์› ํด๋ก  ์ž‘์—…์ด ๋๋‚ฌ์Šต๋‹ˆ๋‹ค.

1๋‹จ๊ณ„์—์„œ๋Š” Express์„œ๋ฒ„(BE)์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋“ค์„ Axios๋กœ ์š”์ฒญํ•˜์—ฌ์„œ **Vuex**๋กœ ์ค‘์•™๋ฐ์ดํ„ฐ ๊ด€๋ฆฌํ•˜๋Š” ์‹ค์Šต์„ ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. 2๋‹จ๊ณ„ 8๊ฐ•๋ถ€ํ„ฐ๋Š” Express ์„œ๋ฒ„(BE)์— ๋ฉ”์ธ์—์„œ ์ƒ์„ฑํ•œ ์Šฌ๋ผ์ด๋“œ ๋ฐ์ดํ„ฐ๋“ค์„ DB์— ์ €์žฅํ•˜๊ณ  Axios๋กœ ์š”์ฒญํ•˜์—ฌ์„œ Vuex๋ณด๋‹ค ์‚ฌ์šฉ๋ฒ•์ด ์‹ฌํ”Œํ•œ **Pinia**๋กœ ์ค‘์•™๋ฐ์ดํ„ฐ ๊ด€๋ฆฌํ•˜๋Š” ์‹ค์Šต์„ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๐Ÿ’ฌ ๋Œ“๊ธ€

    โ€ป ๋กœ๊ทธ์ธ ํ›„ ๋Œ“๊ธ€์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.