๋ฆฌ์กํธ์ ์ต์ํด์ ธ์๊ณ , vue๋ฅผ ๋ ํํด์ ์ฌ์ฉํด๋ณด๋
์์ง ์ด์ํด์... ์ปดํฌ๋ํธ๋ก props๋ฅผ ์ ๋ฌํ ๋๋ ์ด๋ป๊ฒ ํ๋ ์ฐพ์๋ณด๋ค๊ฐ ๊น๋จน์๊น๋ด ์์ฑํจ
1. CreditCart ์ปดํฌ๋ํธ
<template>
<div class="flex flex-col justify-between credit-content p-8">
<p class="text-3xl font-PretendardBold">{{ price }} ์</p>
<div>
<p class="text-lg text-gray-500">์ด {{ count }}๊ฑด ๋ฐ์ก๊ฐ๋ฅํฉ๋๋ค</p>
<p class="text-lg text-gray-500">1๊ฑด๋น 15์์ ๊ฒฐ์ ๊ฐ๋ฅํฉ๋๋ค</p>
</div>
<div class="flex justify-between">
<p class="text-2xl font-PretendardSemiBold">{{ credit }} ํฌ๋ ๋ง</p>
<div
class="flex justify-center items-center font-PretendardSemiBold w-16 h-8 rounded-2xl bg-lightBlue text-darkPurple"
>
+ 10%
</div>
</div>
<div class="p-4 bg-lightGray2 h-20">
<div class="flex justify-between w-full">
<div>๊ธฐ๋ณธ ํฌ๋ ๋ง</div>
<div>{{ basic }}</div>
</div>
<div class="flex justify-between w-full">
<div>์ถ๊ฐ ํฌ๋ ๋ง</div>
<div>+ {{ add }}</div>
</div>
</div>
<button
class="w-full h-16 bg-buttonPurple2 rounded-lg my-2 text-xl text-white"
>
๊ตฌ๋งคํ๊ธฐ
</button>
</div>
</template>
<script>
export default {
props: {
price: {
type: String,
},
count: {
type: String,
},
credit: {
type: String,
},
basic: {
type: String,
},
add: {
type: String,
},
},
};
</script>
<style></style>
script์ props์ ๋ถ๋ชจ์ปดํฌ๋ํธ์์ props๋ก ๋ฐ์ ๋ฐ์ดํฐ type ๊ณผ ์ด๋ฆ ์์ฑ default๊ฐ๋ ์์ฑ๊ฐ๋ฅํจ
{{}} ๋ฅผ ์ฌ์ฉํ์ฌ
๋ฐ์ธ๋ฉ ๊ฐ๋ฅ
2. ๋ถ๋ชจ ์ปดํฌ๋ํธ
์์ ์ปดํฌ๋ํธ import ํ ์ ๋ฌํ๊ณ ์ ํ๋ ๋ฐ์ดํฐ๋ฅผ props๋ก ์ ๋ฌํ๋ฉด๋จ
<CreditCard
price="10,000"
count="76,667"
credit="110,000"
basic="100,000"
add="10,000"
/>
</div>
</div>
</div>
</template>
<script>
import CreditCard from "../components/CreditCard.vue";
export default {
components: {
CreditCard,
},
};
'FRONTEND > Vue' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [Vue3 + vite + tailwindCSS] ํธ์ํฐ ํด๋ก ์ฝ๋ฉ - ํ์๊ฐ์ ํ์ด์ง (1) | 2024.03.15 |
|---|---|
| [Vue] <Transition> ์ปดํฌ๋ํธ -> vue์์ ์ ๋๋ฉ์ด์ ์์ (0) | 2024.02.25 |
| [Vue+Vite] vite-svg-loader ์ฌ์ฉํ๊ธฐ (0) | 2024.02.22 |
| [Vue+Vite] Vue+Vite ๋ผ์ฐํฐ ์ฌ์ฉํ๊ธฐ (0) | 2024.02.22 |
| [Vue+Vite] Vue+Vite ํ ์ผ์๋(Tailwind ) ์ฌ์ฉํ๊ธฐ (0) | 2024.02.20 |