Syw.Frontend

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

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

2-4-๊ณผ์ œ. ์„ ์ƒ๋‹˜ ๊ธฐํš์ „ ์ค„๋‚ด๋ฆผ ์ฒ˜๋ฆฌ ๋ฐ ์ „์—ญ ํฐํŠธ ๋ณ€๊ฒฝ

โœ… ๊ณผ์ œ 1 ์ค„๋‚ด๋ฆผ ์ฒ˜๋ฆฌ ๊ตฌํ˜„ - computed๋กœ <br> ์ฒ˜๋ฆฌ ํ›„ v-html ์‚ฌ์šฉ

๐Ÿ” ์ˆ˜์ •๋œ TeacherPromoCard.vue

<template>
  <div class="promo-card">
    <div class="text-area">
      <h4 class="title" v-html="formattedTitle"></h4>
      <p class="desc">{{ description }}</p>
      <p class="subject">{{ subject }} {{ name }}</p>
    </div>
    <img class="profile-img" :src="img" :alt="name" />
  </div>
</template>

<script>
export default {
  name: "TeacherPromoCard",
  props: {
    title: String,
    description: String,
    name: String,
    subject: String,
    img: String,
  },
  computed: {
    formattedTitle() {
      return this.title.replace(/\n/g, "<br />");
    },
  },
};
</script>

๐Ÿ”’ ๋ณด์•ˆ ์ฃผ์˜์‚ฌํ•ญ

  • v-html์„ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ์™ธ๋ถ€ ์ž…๋ ฅ๊ฐ’์„ ๊ทธ๋Œ€๋กœ ๋„ฃ์ง€ ์•Š๋„๋ก ์ฃผ์˜ํ•˜์„ธ์š”.
  • ์ด ๊ฒฝ์šฐ์—” ๋‚ด๋ถ€ ํ•˜๋“œ์ฝ”๋”ฉ๋œ ๋ฐ์ดํ„ฐ์ด๋ฏ€๋กœ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค.

โœ… ๊ฒฐ๊ณผ

  • title: "ํ๋ฆ„์€ ์ƒˆ๋กญ๊ฒŒ,\n๋ณธ์งˆ์€ ๊ทธ๋Œ€๋กœ" ํ˜•ํƒœ์ผ ๋•Œ

    โ†’ ํ๋ฆ„์€ ์ƒˆ๋กญ๊ฒŒ,<br>๋ณธ์งˆ์€ ๊ทธ๋Œ€๋กœ ๋กœ ๋ Œ๋”๋˜์–ด ์ค„๋ฐ”๊ฟˆ ์ฒ˜๋ฆฌ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

โœ… ๊ณผ์ œ 2 ์ „์—ญ ํฐํŠธ ์ˆ˜์ •

๐Ÿ” ์ˆ˜์ •๋œ .base.scss

@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap");

:root {
  --font-noto: "Noto Sans KR";
  --font-gothic: "๋ง‘์€ ๊ณ ๋”•", "Malgun Gothic", "๋‹์›€", "Dotum", sans-serif;
  // ์ƒ๋žต
}

/* reset */
html,
body {
  **font-family: var(--font-noto);**
  font-size: 13px;
  color: #000;
  letter-spacing: -0.05em;
  line-height: 1.3;
  margin: 0;
  padding: 0;
  border: 0;
}

๐Ÿ’ฌ ๋Œ“๊ธ€

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