Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
80f124ec
Commit
80f124ec
authored
Jan 12, 2021
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: test
parent
ad2ca060
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
28 deletions
+9
-28
doublePickers.js
packages/test_cqj/src/demos/doublePickers.js
+4
-26
index.js
packages/test_cqj/src/index.js
+2
-0
test_cqj.md
packages/test_cqj/src/test_cqj.md
+3
-2
No files found.
packages/test_cqj/src/demos/doublePickers.js
View file @
80f124ec
...
...
@@ -9,23 +9,15 @@ const TestDemo = () => {
const
[
endTime
,
setEndTime
]
=
useState
(
moment
(
new
Date
(),
'YYYY-MM-DD HH:mm:ss'
),
// 默认值当前时间
);
// 计算时间间隔(分钟)
// const start = new Date(startTime.format('YYYY-MM-DD HH:mm:ss')).getTime();
// const end = new Date(endTime.format('YYYY-MM-DD HH:mm:ss')).getTime();
// const minuteInterval = (end - start);
// if (minuteInterval <= 0) {
// notification.error({
// message: '时间设置有误',
// description: '起始时间应该早于结束时间',
// });
// }
// DatePicker改变点击确定时
const
changeStartTime
=
(
time
)
=>
{
setStartTime
(
time
);
};
const
changeEndTime
=
(
time
)
=>
{
setEndTime
(
time
);
};
const
disabledDate
=
(
current
)
=>
{
return
current
&&
current
<
startTime
;
}
// 近1/6/12/24小时
const
setTime
=
(
time
)
=>
{
setEndTime
(
moment
(
new
Date
(),
'YYYY-MM-DD HH:mm:ss'
));
...
...
@@ -33,14 +25,6 @@ const TestDemo = () => {
moment
(
new
Date
(
new
Date
().
getTime
()
-
time
*
60
*
60
*
1000
),
'YYYY-MM-DD HH:mm:ss'
),
);
};
function
onChange
(
value
,
dateString
)
{
console
.
log
(
'Selected Time: '
,
value
);
console
.
log
(
'Formatted Selected Time: '
,
dateString
);
}
function
onOk
(
value
)
{
console
.
log
(
'onOk: '
,
value
);
}
return
(
<>
...
...
@@ -53,16 +37,10 @@ const TestDemo = () => {
<
TimePicker
placeholder
=
"结束时间"
value
=
{
endTime
}
disabledDate
=
{
disabledDate
}
onChange
=
{
changeEndTime
}
style
=
{{
marginRight
:
'10px'
}}
/
>
{
/* <RangePicker
picker="quarter"
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
onChange={onChange}
onOk={onOk}
/> */
}
<
/Col
>
<
/Row
>
<
Row
style
=
{{
marginTop
:
'10px'
}}
>
...
...
packages/test_cqj/src/index.js
View file @
80f124ec
...
...
@@ -14,6 +14,7 @@ TimePicker.defaultProps = {
className
:
'panda-TimePicker'
,
format
:
'YYYY-MM-DD HH:mm:ss'
,
showTime
:
true
,
picker
:
'date'
,
};
TimePicker
.
propTypes
=
{
...
...
@@ -22,6 +23,7 @@ TimePicker.propTypes = {
className
:
PropTypes
.
string
,
// 类名称
format
:
PropTypes
.
string
,
// 格式
showTime
:
PropTypes
.
bool
,
// 是否增加具体时间选择功能
picker
:
PropTypes
.
oneOf
([
'date'
,
'week'
,
'month'
,
'quater'
,
'year'
]),
// 设置选择器类型
};
export
default
TimePicker
;
packages/test_cqj/src/test_cqj.md
View file @
80f124ec
...
...
@@ -21,7 +21,7 @@ group:
<code
src=
"./index.js"
>
## 不展示时间
##
只展示日期,
不展示时间
时间格式按照
`YYYY-MM-DD`
展示。
...
...
@@ -48,4 +48,5 @@ group:
| allowClear | 是否展示清除按钮 | boolean | true | |
| bordered | 是否展示边框 | boolean | true | |
| format | 设置日期格式,为数组时支持多格式匹配,展示以第一个为准。配置参考
<a
href=
"http://momentjs.com/"
>
moment.js
</a>
,支持自定义格式 | string | YYYY-MM-DD HH:mm:ss | |
| showTime | 是否展示边框 | boolean | true | |
| showTime | 是否展示具体时间 | boolean | true | |
| picker | 设置选择器类型 |
`date/ week/ month/quarter/year`
| date | |
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment