@mijadesign/nut-mcp 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/services/aliases.service.d.ts +1 -0
- package/dist/services/aliases.service.js +19 -0
- package/dist/services/doc-parser.service.d.ts +3 -0
- package/dist/services/doc-parser.service.js +162 -0
- package/dist/services/index.services.d.ts +3 -0
- package/dist/services/index.services.js +71 -0
- package/dist/services/paths.service.d.ts +5 -0
- package/dist/services/paths.service.js +18 -0
- package/dist/tools/base.tool.d.ts +8 -0
- package/dist/tools/base.tool.js +27 -0
- package/dist/tools/get-component-doc.tool.d.ts +12 -0
- package/dist/tools/get-component-doc.tool.js +40 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/list-components.tool.d.ts +8 -0
- package/dist/tools/list-components.tool.js +32 -0
- package/dist/tools/search-components.tool.d.ts +12 -0
- package/dist/tools/search-components.tool.js +61 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.js +1 -0
- package/docs/docs/aliases.json +59 -0
- package/docs/docs/components/base/button/index.md +415 -0
- package/docs/docs/components/base/cell/index.md +279 -0
- package/docs/docs/components/base/configprovider/index.md +215 -0
- package/docs/docs/components/base/image/index.md +282 -0
- package/docs/docs/components/base/overlay/index.md +288 -0
- package/docs/docs/components/dentry/cascader/index.md +1080 -0
- package/docs/docs/components/dentry/checkbox/index.md +842 -0
- package/docs/docs/components/dentry/datepicker/index.md +489 -0
- package/docs/docs/components/dentry/form/index.md +457 -0
- package/docs/docs/components/dentry/input/index.md +257 -0
- package/docs/docs/components/dentry/picker/index.md +621 -0
- package/docs/docs/components/dentry/radio/index.md +364 -0
- package/docs/docs/components/dentry/searchbar/index.md +317 -0
- package/docs/docs/components/dentry/selector/index.md +295 -0
- package/docs/docs/components/dentry/switch/index.md +300 -0
- package/docs/docs/components/dentry/textarea/index.md +231 -0
- package/docs/docs/components/dentry/uploader/index.md +745 -0
- package/docs/docs/components/exhibition/collapse/index.md +339 -0
- package/docs/docs/components/exhibition/swiper/index.md +385 -0
- package/docs/docs/components/exhibition/tag/index.md +253 -0
- package/docs/docs/components/feedback/dialog/index.md +306 -0
- package/docs/docs/components/feedback/drag/index.md +164 -0
- package/docs/docs/components/feedback/empty/index.md +211 -0
- package/docs/docs/components/feedback/infiniteloading/index.md +397 -0
- package/docs/docs/components/feedback/noticebar/index.md +175 -0
- package/docs/docs/components/feedback/popup/index.md +563 -0
- package/docs/docs/components/feedback/pulltorefresh/index.md +254 -0
- package/docs/docs/components/feedback/toast/index.md +355 -0
- package/docs/docs/components/layout/divider/index.md +162 -0
- package/docs/docs/components/layout/grid/index.md +386 -0
- package/docs/docs/components/layout/space/index.md +196 -0
- package/docs/docs/components/nav/tabs/index.md +955 -0
- package/docs/docs/components-index.json +233 -0
- package/package.json +34 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 8
|
|
3
|
+
demoUrl: 'https://frontend.mishudata.com/mobile/demo/#/dentry/pages/datepicker/index'
|
|
4
|
+
group:
|
|
5
|
+
title: 数据录入
|
|
6
|
+
order: 5
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# DatePicker 日期选择器 <Badge>2.0.0</Badge>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
时间选择器,支持日期、年月、时分等维度,通常与弹出层组件配合使用。
|
|
13
|
+
|
|
14
|
+
## 引入
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { DatePicker } from '@nutui/nutui-taro';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 示例代码
|
|
21
|
+
|
|
22
|
+
### 选择日期
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Cell, DatePicker } from '@mijadesign/mjui-react-taro'
|
|
27
|
+
import { ArrowRight } from '@nutui/icons-react-taro'
|
|
28
|
+
import React, { useState } from 'react'
|
|
29
|
+
|
|
30
|
+
const useDatePicker = (initialDate: Date) => {
|
|
31
|
+
const year = initialDate.getFullYear()
|
|
32
|
+
const month = String(initialDate.getMonth() + 1).padStart(2, '0')
|
|
33
|
+
const day = String(initialDate.getDate()).padStart(2, '0')
|
|
34
|
+
|
|
35
|
+
const defaultDesc = `${year}年${month}月${day}日`
|
|
36
|
+
const defaultValue = `${year}-${month}-${day}`
|
|
37
|
+
|
|
38
|
+
return { defaultDesc, defaultValue }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const Demo1 = () => {
|
|
42
|
+
const marginLeft = { marginLeft: '4px' }
|
|
43
|
+
|
|
44
|
+
const defaultDate = new Date()
|
|
45
|
+
const { defaultDesc: defaultDesc1, defaultValue: defaultValue1 } = useDatePicker(defaultDate)
|
|
46
|
+
const { defaultValue: defaultDesc2, defaultValue: defaultValue2 } = useDatePicker(defaultDate)
|
|
47
|
+
|
|
48
|
+
const [show1, setShow1] = useState(false)
|
|
49
|
+
const [desc1, setDesc1] = useState(defaultDesc1)
|
|
50
|
+
|
|
51
|
+
const [show2, setShow2] = useState(false)
|
|
52
|
+
const [value, setValue] = useState(defaultValue2)
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Cell.Group>
|
|
56
|
+
<Cell
|
|
57
|
+
className="nutui-cell-clickable"
|
|
58
|
+
title="日期选择"
|
|
59
|
+
onClick={() => setShow2(true)}
|
|
60
|
+
extra={
|
|
61
|
+
<>
|
|
62
|
+
{value}
|
|
63
|
+
<DatePicker
|
|
64
|
+
title="日期选择"
|
|
65
|
+
visible={show2}
|
|
66
|
+
value={new Date(value)}
|
|
67
|
+
onClose={() => setShow2(false)}
|
|
68
|
+
threeDimensional={false}
|
|
69
|
+
onConfirm={(_, values) => setValue(values.join('-'))}
|
|
70
|
+
/>
|
|
71
|
+
<ArrowRight style={marginLeft} />
|
|
72
|
+
</>
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
<Cell
|
|
76
|
+
className="nutui-cell-clickable"
|
|
77
|
+
title="日期选择(显示中文)"
|
|
78
|
+
onClick={() => setShow1(true)}
|
|
79
|
+
extra={
|
|
80
|
+
<>
|
|
81
|
+
{desc1}
|
|
82
|
+
<DatePicker
|
|
83
|
+
title="日期选择"
|
|
84
|
+
visible={show1}
|
|
85
|
+
showChinese
|
|
86
|
+
defaultValue={new Date(defaultValue1)}
|
|
87
|
+
onClose={() => setShow1(false)}
|
|
88
|
+
onConfirm={(options) => setDesc1(options.map((option) => option.label).join(''))}
|
|
89
|
+
/>
|
|
90
|
+
<ArrowRight style={marginLeft} />
|
|
91
|
+
</>
|
|
92
|
+
}
|
|
93
|
+
/>
|
|
94
|
+
</Cell.Group>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default Demo1
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 选择月日
|
|
103
|
+
|
|
104
|
+
DatetimePicker 通过 type 属性来定义需要选择的时间类型。将 type 设置为 year-month 即可选择年份和月份,设置为 month-day 即可选择月份和日期。
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Cell, DatePicker, PickerOptions, PickerValue } from '@mijadesign/mjui-react-taro'
|
|
109
|
+
import { ArrowRight } from '@nutui/icons-react-taro'
|
|
110
|
+
import React, { useState } from 'react'
|
|
111
|
+
|
|
112
|
+
const Demo2 = () => {
|
|
113
|
+
const marginLeft = { marginLeft: '4px' }
|
|
114
|
+
|
|
115
|
+
const defaultValue = new Date()
|
|
116
|
+
const year = defaultValue.getFullYear()
|
|
117
|
+
const month = String(defaultValue.getMonth() + 1).padStart(2, '0')
|
|
118
|
+
const endMonth = String(defaultValue.getMonth() + 2).padStart(2, '0')
|
|
119
|
+
const day = String(defaultValue.getDate()).padStart(2, '0')
|
|
120
|
+
|
|
121
|
+
const [show, setShow] = useState(false)
|
|
122
|
+
const [desc, setDesc] = useState(`${month}-${day}`)
|
|
123
|
+
const confirm = (values: PickerValue[], options: PickerOptions) => {
|
|
124
|
+
setDesc(options.map((option) => option.label).join('-'))
|
|
125
|
+
}
|
|
126
|
+
return (
|
|
127
|
+
<Cell.Group>
|
|
128
|
+
<Cell
|
|
129
|
+
className="nutui-cell-clickable"
|
|
130
|
+
title="限制开始结束时间"
|
|
131
|
+
onClick={() => setShow(true)}
|
|
132
|
+
extra={
|
|
133
|
+
<>
|
|
134
|
+
{desc}
|
|
135
|
+
<DatePicker
|
|
136
|
+
title="日期选择"
|
|
137
|
+
startDate={new Date()}
|
|
138
|
+
endDate={new Date(`${year}-${endMonth}-${day}`)}
|
|
139
|
+
defaultValue={new Date(`${year}-${month}-${day}`)}
|
|
140
|
+
type="month-day"
|
|
141
|
+
visible={show}
|
|
142
|
+
onClose={() => setShow(false)}
|
|
143
|
+
onConfirm={(options, values) => confirm(values, options)}
|
|
144
|
+
/>
|
|
145
|
+
<ArrowRight style={marginLeft} />
|
|
146
|
+
</>
|
|
147
|
+
}
|
|
148
|
+
/>
|
|
149
|
+
</Cell.Group>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
export default Demo2
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 选择年月日时分
|
|
157
|
+
|
|
158
|
+
将 type 设置为 datetime 即可选择完整的时间。
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Cell, DatePicker, PickerOptions, PickerValue } from '@mijadesign/mjui-react-taro'
|
|
163
|
+
import { ArrowRight } from '@nutui/icons-react-taro'
|
|
164
|
+
import React, { useState } from 'react'
|
|
165
|
+
|
|
166
|
+
const Demo3 = () => {
|
|
167
|
+
const marginLeft = { marginLeft: '4px' }
|
|
168
|
+
|
|
169
|
+
const defaultValue = new Date()
|
|
170
|
+
const year = defaultValue.getFullYear()
|
|
171
|
+
const month = String(defaultValue.getMonth() + 1).padStart(2, '0')
|
|
172
|
+
const day = String(defaultValue.getDate()).padStart(2, '0')
|
|
173
|
+
|
|
174
|
+
const defaultDescription = `${year}-${month}-${day}`
|
|
175
|
+
|
|
176
|
+
const startDate = new Date(2020, 0, 1)
|
|
177
|
+
const endDate = new Date(2025, 10, 1)
|
|
178
|
+
const [show, setShow] = useState(false)
|
|
179
|
+
const [desc, setDesc] = useState(`${defaultDescription} 11:08`)
|
|
180
|
+
const confirm = (values: PickerValue[], options: PickerOptions) => {
|
|
181
|
+
const date = values.slice(0, 3).join('-')
|
|
182
|
+
const time = values.slice(3).join(':')
|
|
183
|
+
setDesc(`${date} ${time}`)
|
|
184
|
+
}
|
|
185
|
+
return (
|
|
186
|
+
<Cell.Group>
|
|
187
|
+
<Cell
|
|
188
|
+
title="选择年月日时分"
|
|
189
|
+
className="nutui-cell-clickable"
|
|
190
|
+
onClick={() => setShow(true)}
|
|
191
|
+
extra={
|
|
192
|
+
<>
|
|
193
|
+
{desc}
|
|
194
|
+
<DatePicker
|
|
195
|
+
title="日期选择"
|
|
196
|
+
startDate={startDate}
|
|
197
|
+
endDate={endDate}
|
|
198
|
+
defaultValue={new Date(`${defaultDescription}T11:08`)}
|
|
199
|
+
visible={show}
|
|
200
|
+
type="datetime"
|
|
201
|
+
onClose={() => setShow(false)}
|
|
202
|
+
onConfirm={(options, values) => confirm(values, options)}
|
|
203
|
+
/>
|
|
204
|
+
<ArrowRight style={marginLeft} />
|
|
205
|
+
</>
|
|
206
|
+
}
|
|
207
|
+
/>
|
|
208
|
+
</Cell.Group>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
export default Demo3
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 选择时分秒
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
import { Cell, DatePicker, PickerOptions, PickerValue } from '@mijadesign/mjui-react-taro'
|
|
220
|
+
import { ArrowRight } from '@nutui/icons-react-taro'
|
|
221
|
+
import React, { useState } from 'react'
|
|
222
|
+
|
|
223
|
+
const Demo4 = () => {
|
|
224
|
+
const marginLeft = { marginLeft: '4px' }
|
|
225
|
+
|
|
226
|
+
const defaultValue = new Date()
|
|
227
|
+
const year = defaultValue.getFullYear()
|
|
228
|
+
const month = String(defaultValue.getMonth() + 1).padStart(2, '0')
|
|
229
|
+
const day = String(defaultValue.getDate()).padStart(2, '0')
|
|
230
|
+
|
|
231
|
+
const defaultDescription = `${year}-${month}-${day}`
|
|
232
|
+
const startDate = new Date(2020, 0, 1)
|
|
233
|
+
const endDate = new Date(2025, 10, 1)
|
|
234
|
+
const [show, setShow] = useState(false)
|
|
235
|
+
const [desc, setDesc] = useState('10:10:00')
|
|
236
|
+
const confirm = (values: PickerValue[], options: PickerOptions) => {
|
|
237
|
+
setDesc(options.map((option) => option.label).join(':'))
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const [show2, setShow2] = useState(false)
|
|
241
|
+
const [desc2, setDesc2] = useState('10:10')
|
|
242
|
+
const confirm2 = (options: PickerOptions, values: PickerValue[]) => {
|
|
243
|
+
setDesc2(options.map((option) => option.label).join(':'))
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
<Cell.Group>
|
|
248
|
+
<Cell
|
|
249
|
+
title="选择时分秒"
|
|
250
|
+
className="nutui-cell-clickable"
|
|
251
|
+
onClick={() => setShow(true)}
|
|
252
|
+
extra={
|
|
253
|
+
<>
|
|
254
|
+
{desc}
|
|
255
|
+
<DatePicker
|
|
256
|
+
title="日期选择"
|
|
257
|
+
type="time"
|
|
258
|
+
defaultValue={new Date(`${defaultDescription}T${desc}`)}
|
|
259
|
+
startDate={startDate}
|
|
260
|
+
endDate={endDate}
|
|
261
|
+
visible={show}
|
|
262
|
+
onClose={() => setShow(false)}
|
|
263
|
+
onConfirm={(options, values) => confirm(values, options)}
|
|
264
|
+
/>
|
|
265
|
+
<ArrowRight style={marginLeft} />
|
|
266
|
+
</>
|
|
267
|
+
}
|
|
268
|
+
/>
|
|
269
|
+
<Cell
|
|
270
|
+
title="选择时分"
|
|
271
|
+
className="nutui-cell-clickable"
|
|
272
|
+
onClick={() => setShow2(true)}
|
|
273
|
+
extra={
|
|
274
|
+
<>
|
|
275
|
+
{desc2}
|
|
276
|
+
<DatePicker
|
|
277
|
+
title="日期选择"
|
|
278
|
+
type="hour-minutes"
|
|
279
|
+
defaultValue={new Date(`${defaultDescription}T${desc2}`)}
|
|
280
|
+
startDate={startDate}
|
|
281
|
+
endDate={endDate}
|
|
282
|
+
visible={show2}
|
|
283
|
+
onClose={() => setShow2(false)}
|
|
284
|
+
onConfirm={(options, values) => confirm2(options, values)}
|
|
285
|
+
/>
|
|
286
|
+
<ArrowRight style={marginLeft} />
|
|
287
|
+
</>
|
|
288
|
+
}
|
|
289
|
+
/>
|
|
290
|
+
</Cell.Group>
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
export default Demo4
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### 选择时分
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import { Cell, DatePicker, PickerOption, PickerOptions, PickerValue } from '@mijadesign/mjui-react-taro'
|
|
302
|
+
import { ArrowRight } from '@nutui/icons-react-taro'
|
|
303
|
+
import React, { useState } from 'react'
|
|
304
|
+
|
|
305
|
+
const Demo5 = () => {
|
|
306
|
+
const marginLeft = { marginLeft: '4px' }
|
|
307
|
+
|
|
308
|
+
const defaultValue = new Date()
|
|
309
|
+
const year = defaultValue.getFullYear()
|
|
310
|
+
const month = String(defaultValue.getMonth() + 1).padStart(2, '0')
|
|
311
|
+
const day = String(defaultValue.getDate()).padStart(2, '0')
|
|
312
|
+
|
|
313
|
+
const defaultDescription = `${year}-${month}-${day}`
|
|
314
|
+
const [show, setShow] = useState(false)
|
|
315
|
+
const [desc, setDesc] = useState(`${defaultDescription} 10:10`)
|
|
316
|
+
const confirm = (values: PickerValue[], options: PickerOptions) => {
|
|
317
|
+
const date = options
|
|
318
|
+
.slice(1, 3)
|
|
319
|
+
.map((op) => op.label)
|
|
320
|
+
.join('')
|
|
321
|
+
const time = options
|
|
322
|
+
.slice(3)
|
|
323
|
+
.map((op) => op.value)
|
|
324
|
+
.join(':')
|
|
325
|
+
setDesc(`${options[0].label}年${date} ${time}`)
|
|
326
|
+
}
|
|
327
|
+
const formatter = (type: string, option: PickerOption) => {
|
|
328
|
+
switch (type) {
|
|
329
|
+
case 'year':
|
|
330
|
+
option.label += ''
|
|
331
|
+
break
|
|
332
|
+
case 'month':
|
|
333
|
+
option.label += '月'
|
|
334
|
+
break
|
|
335
|
+
case 'day':
|
|
336
|
+
option.label += '日'
|
|
337
|
+
break
|
|
338
|
+
case 'hour':
|
|
339
|
+
option.label += '时'
|
|
340
|
+
break
|
|
341
|
+
case 'minute':
|
|
342
|
+
option.label += '分'
|
|
343
|
+
break
|
|
344
|
+
default:
|
|
345
|
+
option.label += ''
|
|
346
|
+
}
|
|
347
|
+
return option
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const startDate = new Date(2020, 0, 1)
|
|
351
|
+
const endDate = new Date(2025, 10, 1)
|
|
352
|
+
const [show2, setShow2] = useState(false)
|
|
353
|
+
const [desc2, setDesc2] = useState('10:10:00')
|
|
354
|
+
const confirm2 = (values: PickerValue[], options: PickerOptions) => {
|
|
355
|
+
setDesc2(options.map((option) => option.label).join(':'))
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const defaultDescription3 = `${year}-${month}-${day}T06:00`
|
|
359
|
+
const [show3, setShow3] = useState(false)
|
|
360
|
+
const [desc3, setDesc3] = useState(`${year}年${month}月${day}日 06时`)
|
|
361
|
+
const confirm3 = (values: PickerValue[], options: PickerOptions) => {
|
|
362
|
+
setDesc3(options.map((option) => option.label).join(' '))
|
|
363
|
+
}
|
|
364
|
+
const filter3 = (type: string, options: PickerOptions) => {
|
|
365
|
+
if (type === 'hour') {
|
|
366
|
+
return options.filter((option) => Number(option.value) % 6 === 0)
|
|
367
|
+
}
|
|
368
|
+
return options
|
|
369
|
+
}
|
|
370
|
+
const formatter3 = (type: string, option: PickerOption) => {
|
|
371
|
+
switch (type) {
|
|
372
|
+
case 'year':
|
|
373
|
+
option.label += `年`
|
|
374
|
+
break
|
|
375
|
+
case 'month':
|
|
376
|
+
option.label += `月`
|
|
377
|
+
break
|
|
378
|
+
case 'day':
|
|
379
|
+
option.label += `日`
|
|
380
|
+
break
|
|
381
|
+
case 'hour':
|
|
382
|
+
option.label += `时`
|
|
383
|
+
break
|
|
384
|
+
default:
|
|
385
|
+
option.label += ''
|
|
386
|
+
}
|
|
387
|
+
return option
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return (
|
|
391
|
+
<Cell.Group>
|
|
392
|
+
<Cell
|
|
393
|
+
title="格式化选项"
|
|
394
|
+
className="nutui-cell-clickable"
|
|
395
|
+
onClick={() => setShow(true)}
|
|
396
|
+
extra={
|
|
397
|
+
<>
|
|
398
|
+
{desc}
|
|
399
|
+
<DatePicker
|
|
400
|
+
title="时间选择"
|
|
401
|
+
type="datetime"
|
|
402
|
+
startDate={new Date(2023, 0, 1)}
|
|
403
|
+
endDate={new Date(2026, 10, 1)}
|
|
404
|
+
visible={show}
|
|
405
|
+
defaultValue={new Date(`${defaultDescription}T10:10`)}
|
|
406
|
+
formatter={formatter}
|
|
407
|
+
onClose={() => setShow(false)}
|
|
408
|
+
onConfirm={(options, values) => confirm(values, options)}
|
|
409
|
+
/>
|
|
410
|
+
<ArrowRight style={marginLeft} />
|
|
411
|
+
</>
|
|
412
|
+
}
|
|
413
|
+
/>
|
|
414
|
+
<Cell
|
|
415
|
+
title="分钟数递增步长设置"
|
|
416
|
+
className="nutui-cell-clickable"
|
|
417
|
+
onClick={() => setShow2(true)}
|
|
418
|
+
extra={
|
|
419
|
+
<>
|
|
420
|
+
{desc2}
|
|
421
|
+
<DatePicker
|
|
422
|
+
title="时间选择"
|
|
423
|
+
type="time"
|
|
424
|
+
defaultValue={new Date(`${defaultDescription}T${desc2}`)}
|
|
425
|
+
startDate={startDate}
|
|
426
|
+
endDate={endDate}
|
|
427
|
+
visible={show2}
|
|
428
|
+
minuteStep={5}
|
|
429
|
+
onClose={() => setShow2(false)}
|
|
430
|
+
onConfirm={(options, values) => confirm2(values, options)}
|
|
431
|
+
/>
|
|
432
|
+
<ArrowRight style={marginLeft} />
|
|
433
|
+
</>
|
|
434
|
+
}
|
|
435
|
+
/>
|
|
436
|
+
<Cell
|
|
437
|
+
title="过滤选项"
|
|
438
|
+
className="nutui-cell-clickable"
|
|
439
|
+
onClick={() => setShow3(true)}
|
|
440
|
+
extra={
|
|
441
|
+
<>
|
|
442
|
+
{desc3}
|
|
443
|
+
<DatePicker
|
|
444
|
+
title="时间选择"
|
|
445
|
+
type="datehour"
|
|
446
|
+
startDate={startDate}
|
|
447
|
+
endDate={endDate}
|
|
448
|
+
visible={show3}
|
|
449
|
+
defaultValue={new Date(`${defaultDescription3}`)}
|
|
450
|
+
formatter={formatter3}
|
|
451
|
+
minuteStep={5}
|
|
452
|
+
filter={filter3}
|
|
453
|
+
onClose={() => setShow3(false)}
|
|
454
|
+
onConfirm={(options, values) => confirm3(values, options)}
|
|
455
|
+
/>
|
|
456
|
+
<ArrowRight style={marginLeft} />
|
|
457
|
+
</>
|
|
458
|
+
}
|
|
459
|
+
/>
|
|
460
|
+
</Cell.Group>
|
|
461
|
+
)
|
|
462
|
+
}
|
|
463
|
+
export default Demo5
|
|
464
|
+
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
## DatePicker
|
|
468
|
+
|
|
469
|
+
### Props
|
|
470
|
+
|
|
471
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
472
|
+
| --- | --- | --- | --- |
|
|
473
|
+
| defaultValue | 初始值 | `Date` | `null` |
|
|
474
|
+
| value | 受控 | `Date` | `null` |
|
|
475
|
+
| visible | 是否可见 | `boolean` | `false` |
|
|
476
|
+
| type | 类时间类型,可选值 date time year-month month-day datehour datetime hour-minutes | `string` | `date` |
|
|
477
|
+
| minuteStep | 分钟步进值 | `number` | `1` |
|
|
478
|
+
| showChinese | 每列是否展示中文 | `boolean` | `false` |
|
|
479
|
+
| title | 设置标题 | `string` | `null` |
|
|
480
|
+
| startDate | 开始日期 | `Date` | `十年前` |
|
|
481
|
+
| endDate | 结束日期 | `Date` | `十年后` |
|
|
482
|
+
| formatter | 选项格式化函数 | `(type: string, option: PickerOption) => PickerOption` | `-` |
|
|
483
|
+
| pickerProps | 透传picker属性 | `object` | `-` |
|
|
484
|
+
| filter | 选项过滤函数 | `(type: string, option: PickerOption) => PickerOption[]` | `-` |
|
|
485
|
+
| threeDimensional | 是否开启3D效果 | `boolean` | `true` |
|
|
486
|
+
| onConfirm | 点击确定按钮时触发 | `(options, value) => void` | `-` |
|
|
487
|
+
| onCancel | 点击取消按钮时触发 | `() => void` | `-` |
|
|
488
|
+
| onClose | 确定和取消时,都触发 | `(options, value) => void` | `-` |
|
|
489
|
+
| onChange | 选项改变时触发 | `(options, value, index) => void` | `-` |
|