드래그
드래그 (Drag)
아무 요소나 드래그로 끌어다 놓을 수 있게 만들어 주는 컴포넌트예요. 이동 방향 제한, 경계 제한, 모서리 자동 흡착(attract) 같은 동작도 옵션으로 켤 수 있어요.
출처: 문서
설치 (Install)
import { createApp } from 'vue'
import { Drag } from '@nutui/nutui'
const app = createApp()
app.use(Drag)
사용 예제 (Usage)
기본 사용법 (Basic Usage)
demo: drag basic
방향 제한 (Limit Direction)
demo: drag direction
끌림(자석) 효과 (Attract)
demo: drag attract
경계 제한 (Limit Boundary)
demo: drag boundary
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| attract | Whether to enable automatic edge suction | boolean | false |
| direction | The drag direction limit of the dragged element x, y, all |
string | 'all' |
| boundary | The drag boundary of the dragged element | object | {top: 0,left: 0,right: 0,bottom: 0} |
더 알아보기 (Learn more)
이 글은 NutUI 공식 문서의 영문 원문을 한국어로 번역한 내용이에요. 최신 내용과 전체 문서는 아래 링크에서 확인할 수 있어요:
- 원문 문서: drag doc.en-US.md
- NutUI GitHub 저장소: https://github.com/jd-opensource/nutui