โ
๊ณผ์ 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;
}
๐ฌ ๋๊ธ
โป ๋ก๊ทธ์ธ ํ ๋๊ธ์ ์์ฑํ ์ ์์ต๋๋ค.