본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Layout 레이아웃

원문 보기 위키 갱신

Layout은 화면을 빠르게 배치하기 위한 그리드 컴포넌트예요. Row와 Col 두 컴포넌트가 한 세트예요.

출처: 문서

설치

@nutui/nutui에서 컴포넌트 두 개를 모두 가져와 앱에 등록하세요.

import { createApp } from 'vue'
import { Row, Col } from '@nutui/nutui'

const app = createApp()
app.use(Row)
app.use(Col)

사용 예시

기본 사용법

Layout 컴포넌트는 24칸 그리드를 제공해요. Col에 span 속성을 더해 컬럼 너비의 비율을 정하고, offset 속성으로 컬럼의 오프셋 너비를 정할 수 있어요. 계산 방법은 span과 같아요.

demo: layout basic

컬럼 간격

demo: layout gap

Flex 레이아웃

demo: layout flex

API

Row Props

Attribute Description Type Default
type layout method, optional value is flex string -
gutter spacing between column elements (px) string | number -
justify Flex main axis alignment, optional values are start end center space-around space-between space-evenly string start
align Flex cross axis alignment, optional values are flex-start center flex-end string flex-start
flex-wrap Whether flex wraps, optional values are nowrap wrap reverse string nowrap

Col Props

Attribute Description Type Default
span column element width (divided into 24 parts in total, for example, if there are 3 in a row, then the span value is 8) string | number 24
offset column element offset distance string | number 0

Row Events

Event Description callback parameter
click Triggered when clicked event: MouseEvent

Col Events

Event Description callback parameter
click Triggered when clicked event: MouseEvent

Types v4.3.2

이 컴포넌트는 아래 타입 정의를 함께 내보내요.

import type {
  RowProps,
  RowInstance,
  ColProps,
  ColInstance
} from '@nutui/nutui';

더 알아보기 (Learn more)