카드
카드 (Card)
상품 이미지, 가격 같은 정보를 카드 형태로 보여 주는 컴포넌트예요. 좌측 썸네일과 가격, 상점 정보를 기본으로 제공하고 슬롯으로 원하는 영역을 자유롭게 바꿀 수 있어요.
출처: 문서
설치 (Install)
import { createApp } from 'vue'
import { Card } from '@nutui/nutui'
const app = createApp()
app.use(Card)
사용 예제 (Usage)
기본 사용법 (Basic Usage)
demo: card basic
상품 리스트 커스텀 (Custom prolist)
demo: card tag
내용 커스텀 (Custom Content)
demo: card shop
우측 하단 콘텐츠 커스텀 (Customize bottom right content)
demo: card footer
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| img-url | Left thumb image URL |
string | - |
| title | Title | string | - |
| price | Price | string | - |
| vip-price | vip-price | string | - |
| shop-desc | shop-desc | string | - |
| delivery | delivery | string | - |
| shop-name | shop-name | string | - |
| is-need-price | Whether price display is required | Boolean | true |
Events
| Event | Description | Arguments |
|---|---|---|
| click | click event | event: MouseEvent |
Slots
| Name | Description |
|---|---|
| prolist | Custom product introduction |
| price | Custom price |
| origin | Custom content behind the price |
| shop-tag | Custom shop introduction |
| footer | Customize bottom right content |
테마 (Theming)
CSS 변수 (CSS Variables)
컴포넌트는 스타일을 커스터마이징할 때 쓸 수 있는 CSS 변수를 제공해요. 자세한 사용법은 ConfigProvider 컴포넌트 문서를 참고하세요.
| Name | Default Value |
|---|---|
| --nut-card-font-size-0 | var(--nut-font-size-0) |
| --nut-card-font-size-1 | var(--nut-font-size-1) |
| --nut-card-font-size-2 | var(--nut-font-size-2) |
| --nut-card-font-size-3 | var(--nut-font-size-3) |
| --nut-card-left-border-radius | 0 |
| --nut-card-left-background-color | inherit |
더 알아보기 (Learn more)
이 글은 NutUI 공식 문서의 영문 원문을 한국어로 번역한 내용이에요. 최신 내용과 전체 문서는 아래 링크에서 확인할 수 있어요:
- 원문 문서: card doc.en-US.md
- NutUI GitHub 저장소: https://github.com/jd-opensource/nutui