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

DatePicker

원문 보기 위키 갱신

DatePicker (날짜 선택)

시간을 선택하는 데 사용하는 컴포넌트예요. 날짜와 시간 차원을 모두 지원하고, 보통 Popup 컴포넌트와 함께 써요.

출처: 문서

본문

소개 (Intro)

시간 선택에 사용해요. 날짜와 시간 차원을 지원하고, 보통 Popup 컴포넌트와 함께 사용해요.

설치 (Install)

import { createApp } from 'vue'
import { DatePicker } from '@nutui/nutui'

const app = createApp()
app.use(DatePicker)

데모 (Demos)

아래 항목들은 원문 문서의 대화형 데모로 제공돼요.

  • 날짜 선택 (Choose Date) — demo: datepicker basic
  • 팝업과 함께 (With popup) — demo: datepicker pop
  • 연-월 선택 (Choose Year-Month) — demo: datepicker yearMonth
  • 월-일 선택 (Choose Month-Day) — demo: datepicker monthDay
  • 날짜+시간 선택 (Choose DateTime) — demo: datepicker date-time
  • 시간 선택 (Choose Time) — demo: datepicker time
  • 시-분 선택 (Choose Hour-Minute) v4.0.5 — demo: datepicker hour-minute
  • 옵션 포맷터 (Option Formatter) — demo: datepicker format
  • 옵션 스텝 (Option Steps) — demo: datepicker step
  • 옵션 필터 (Option Filter) — demo: datepicker filter

API

Props

Attribute Description Type Default
v-model Default Date date null
type Can be set to date time year-month month-day datehour hour-minute(v4.0.5) string date
minute-step Option minute step number 1
is-show-chinese Show Chinese boolean false
min-date Start date date Ten years ago on January 1
max-date End date date Ten years later on December 31
formatter Option text formatter (type: string, option: PickerOption) => PickerOption
filter Option filter (type: string, option: PickerOption) => PickerOption[]
title Title string null
ok-text Text of confirm button string confirm
cancel-text Text of cancel button string cancel
three-dimensional Turn on 3D effects boolean true
swipe-duration Duration of the momentum animation number | string 1000
visible-option-num Count of visible columns number | string 7
option-height Option height number | string 36
show-toolbar Whether to show toolbar boolean true

Events

Event Description Arguments
confirm Emitted when click confirm button. { selectedValue, selectedOptions }
cancel Emitted when click cancel button. { selectedValue, selectedOptions }
change Emitted when current option changed. { columnIndex, selectedValue, selectedOptions }

Slots

Name Description
default Custom content bottom columns
top Custom content top columns

PickerOption 데이터 구조 (Data Structure of PickerOption)

Key Description Type Default
text Text of column string | number -
value Value of column string | number -
children Cascader Option Array -
className Extra CalssName string -

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

Name Default Value
--nut-picker-cancel-color #808080
--nut-picker-ok-color var(--nut-primary-color)
--nut-picker-bar-cancel-font-size 14px
--nut-picker-bar-ok-font-size 14px
--nut-picker-bar-button-padding 0 15px
--nut-picker-bar-title-font-size 16px
--nut-picker-bar-title-color var(--nut-title-color)
--nut-picker-bar-title-font-weight normal
--nut-picker-item-height 36px
--nut-picker-item-text-color var(--nut-title-color)
--nut-picker-item-text-font-size 14px
--nut-picker-item-active-line-border 1px solid #d8d8d8

더 알아보기 (Learn more)