TrendArrow 추세 화살표
TrendArrow는 값의 상승·하락을 화살표로 보여주는 컴포넌트예요. 주식·지표처럼 방향이 중요한 수치 옆에 붙이면 좋아요.
출처: 문서
본문
설치
@nutui/nutui에서 컴포넌트를 가져와 앱에 등록하면 바로 쓸 수 있어요.
import { createApp } from 'vue'
import { TrendArrow } from '@nutui/nutui'
const app = createApp()
app.use(TrendArrow)
사용 예시
기본 사용법
demo: trendarrow basic
소수점 자릿수 지정
demo: trendarrow digits
화살표를 앞에 두기
demo: trendarrow left
부호 표시
demo: trendarrow sign
0 표시 여부
demo: trendarrow zero
색상 커스터마이즈
demo: trendarrow color
아이콘 커스터마이즈
::: demo
demo: trendarrow icon
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| rate | Value, the arrow is up when it is greater than 0, and the arrow is down when it is less than 0 | number | - |
| digits | decimal precision | number | 2 |
| show-sign | Whether to display plus and minus signs | boolean | false |
| show-zero | whether to show 0 | boolean | false |
| arrow-left | whether to show an arrow to the left of the number | boolean | false |
| sync-text-color | Whether the text color is in sync with the arrow | boolean | true |
| text-color | text color | string | #333333 |
| rise-color | up arrow color | string | #fa2c19 |
| drop-color | down arrow color | string | #64b578 |
Slots
| Name | Description |
|---|---|
| up-icon | custom up icon |
| down-icon | custom down icon |
Types v4.3.4
이 컴포넌트는 아래 타입 정의를 함께 내보내요.
import type {
TrendArrowProps,
TrendArrowInstance
} from '@nutui/nutui'
Theming
CSS Variables
스타일 커스텀에 쓸 수 있는 CSS 변수를 제공해요. 자세한 내용은 ConfigProvider 컴포넌트를 참고하세요.
| Name | Default Value |
|---|---|
| --nut-trendarrow-font-size | 14px |
| --nut-trendarrow-before-icon-margin | 4px |
더 알아보기 (Learn more)
- 원문 문서: NutUI TrendArrow 공식 문서(영문)
- NutUI는 JD.com이 공개한 Vue 3 모바일 컴포넌트 라이브러리예요. 전체 컴포넌트 목록은 공식 문서 사이트에서, 소스 코드는 GitHub 저장소에서 볼 수 있어요.