File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
packages/lib/src/JsonSchemaForm/widgets Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,16 @@ export default {
1313 'value-format' : isNumberValue ? 'timestamp' : 'yyyy-MM-dd' ,
1414 ...otherProps
1515 } ;
16+
17+ const oldInputCall = context . data . on . input ;
18+ context . data . on = {
19+ ...context . data . on ,
20+ input ( val ) {
21+ const trueVal = val === null ? ( isRange ? [ ] : undefined ) : val ;
22+ oldInputCall . apply ( context . data . on , [ trueVal ] ) ;
23+ }
24+ } ;
25+
1626 return h ( 'el-date-picker' , context . data , context . children ) ;
1727 }
1828} ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default {
1313 ...otherProps
1414 } ;
1515
16- // 字符串为 0 时区标准时间
16+ // 字符串为 0 时区ISO标准时间
1717 const oldInputCall = context . data . on . input ;
1818 context . data . on = {
1919 ...context . data . on ,
@@ -22,7 +22,7 @@ export default {
2222 if ( isRange ) {
2323 trueVal = ( val === null ) ? [ ] : val . map ( item => ( new Date ( item ) ) [ isNumberValue ? 'valueOf' : 'toISOString' ] ( ) ) ;
2424 } else {
25- trueVal = ( new Date ( val ) ) [ isNumberValue ? 'valueOf' : 'toISOString' ] ( ) ;
25+ trueVal = ( val === null ) ? undefined : ( new Date ( val ) ) [ isNumberValue ? 'valueOf' : 'toISOString' ] ( ) ;
2626 }
2727
2828 oldInputCall . apply ( context . data . on , [ trueVal ] ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ export default {
1010 'value-format' : 'HH:mm:ss' ,
1111 ...context . data . props
1212 } ;
13+
14+ const oldInputCall = context . data . on . input ;
15+ context . data . on = {
16+ ...context . data . on ,
17+ input ( val ) {
18+ oldInputCall . apply ( context . data . on , [ val === null ? undefined : val ] ) ;
19+ }
20+ } ;
21+
1322 return h ( 'el-time-picker' , context . data , context . children ) ;
1423 }
1524} ;
You can’t perform that action at this time.
0 commit comments