맨 위로 가기
맨 위로 가기 (Backtop)
긴 페이지에서 손쉽게 맨 위로 돌아갈 수 있게 해 주는 버튼 컴포넌트예요. 얼마나 스크롤했을 때 보여 줄지, 화면 어느 위치에 띄울지, 애니메이션 여부까지 조절할 수 있어요.
출처: 문서
설치 (Install)
import { createApp } from 'vue'
import { Backtop } from '@nutui/nutui'
const app = createApp()
app.use(Backtop)
사용 예제 (Usage)
기본 사용법 (Basic Usage)
demo: backtop basic
스크롤 거리 (Distance)
demo: backtop distance
스타일 커스텀 (Custom Style)
demo: backtop custom
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| el-id | Get the parent element of the listening element | string | - |
| bottom | Distance from bottom of page | number | 20 |
| right | Distance from the right side of the page | number | 10 |
| distance | How high to scroll the page vertically | number | 200 |
| z-index | Set the component z-index | number | 10 |
| is-animation | Whether there is animation, mutually exclusive with the duration parameter | boolean | true |
| duration | Set animation duration | number | 1000 |
Events
| Event | Description | Arguments |
|---|---|---|
| click | Emitted when component is clicked | event: MouseEvent |
Slots
| Name | Description |
|---|---|
| default | The default slot is used to customize the content |
Types v4.3.3
이 컴포넌트는 다음 타입 정의를 함께 내보내요:
import type {
BacktopProps,
BacktopInstance
} from '@nutui/nutui'
테마 (Theming)
CSS 변수 (CSS Variables)
컴포넌트는 스타일을 커스터마이징할 때 쓸 수 있는 CSS 변수를 제공해요. 자세한 사용법은 ConfigProvider 컴포넌트 문서를 참고하세요.
| Name | Default Value |
|---|---|
| --nut-backtop-border-color | #e0e0e0 |
더 알아보기 (Learn more)
이 글은 NutUI 공식 문서의 영문 원문을 한국어로 번역한 내용이에요. 최신 내용과 전체 문서는 아래 링크에서 확인할 수 있어요:
- 원문 문서: backtop doc.en-US.md
- NutUI GitHub 저장소: https://github.com/jd-opensource/nutui