TimeSelect (시간 선택)
배송 시간처럼 골라 받을 시간을 선택할 때 쓰는 컴포넌트예요. 왼쪽에는 날짜 패널(TimePannel), 오른쪽에는 시간 상세(TimeDetail)가 나뉘어, 날짜를 고르고 그 날의 시간대를 고르는 흐름으로 동작해요.
출처: 문서
본문
소개 (Intro)
배송 시간 선택에 사용해요.
설치 (Install)
import { createApp } from 'vue'
import { TimeSelect, TimePannel, TimeDetail } from '@nutui/nutui'
const app = createApp()
app.use(TimeSelect)
app.use(TimePannel)
app.use(TimeDetail)
데모 (Demos)
아래 항목들은 원문 문서의 대화형 데모로 제공돼요.
- 기본 사용법 (Basic Usage) —
demo: timeselect basic
- 여러 날짜와 시간 선택 (Multiple dates and times can be selected) —
demo: timeselect multiple
- 제목 변경 (Change Title) —
demo: timeselect title
API
TimeSelect Props
| Attribute |
Description |
Type |
Default |
| visible |
Whether to display elastic layer |
boolean |
false |
| height |
Height of bomb layer |
string |
20% |
| title |
Bomb layer title |
string |
Pickup Time |
| current-key |
Unique identification |
string | number |
0 |
| current-time |
The currently selected time, the array element contains:key: string; list: string[] |
Array |
[] |
| lock-scroll |
Whether the background is locked |
boolean |
true |
Slots
| Name |
Description |
| title |
Change Title |
| pannel |
List for left |
| detail |
Detail Content for right |
TimePannel Props
| Attribute |
Description |
Type |
Default |
| name |
Name of display |
string |
`` |
| pannel-key |
Unique ID, which identifies the currently selected day together with current-key |
string | number |
0 |
TimeDetail Props
| Attribute |
Description |
Type |
Default |
| times |
Selectable time, the same as array elements current-time |
Array |
[] |
TimeSelect Events
| Event |
Description |
Arguments |
| select |
Callback after closing mask |
key: string | number, list: [] |
TimePannel Event
| Event |
Description |
Arguments |
| change |
Click the callback of the content |
pannelKey: string | number |
TimeDetail Event
| Event |
Description |
Arguments |
| select |
Callback of click time |
time: 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-timeselect-title-font-size |
var(--nut-font-size-2) |
| --nut-timeselect-title-color |
var(--nut-title-color) |
| --nut-timeselect-title-width |
100% |
| --nut-timeselect-title-height |
50px |
| --nut-timeselect-title-line-height |
50px |
| --nut-timeselect-pannel-bg-color |
#f6f7f9 |
| --nut-timeselect-timepannel-text-color |
var(--nut-title-color2) |
| --nut-timeselect-timepannel-font-size |
var(--nut-font-size-2) |
| --nut-timeselect-timepannel-cur-bg-color |
var(--nut-white) |
| --nut-timeselect-timepannel-cur-text-color |
#333333 |
| --nut-timeselect-timepannel-width |
140px |
| --nut-timeselect-timepannel-height |
40px |
| --nut-timeselect-timepannel-padding |
15px |
| --nut-timeselect-timedetail-padding |
0 5px 50px 13px |
| --nut-timeselect-timedetail-item-width |
100px |
| --nut-timeselect-timedetail-item-height |
50px |
| --nut-timeselect-timedetail-item-line-height |
50px |
| --nut-timeselect-timedetail-item-bg-color |
#f6f7f9 |
| --nut-timeselect-timedetail-item-border-radius |
5px |
| --nut-timeselect-timedetail-item-text-color |
#333333 |
| --nut-timeselect-timedetail-item-text-font-size |
var(--nut-font-size-2) |
| --nut-timeselect-timedetail-item-cur-bg-color |
var(--nut-primary-color) |
| --nut-timeselect-timedetail-item-cur-border |
var(--nut-primary-color) |
| --nut-timeselect-timedetail-item-cur-text-color |
var(--nut-primary-color) |
더 알아보기 (Learn more)