File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,11 @@ export default {
428
428
if (this .picker ) {
429
429
this .picker .defaultValue = val;
430
430
}
431
+ },
432
+ value (val , oldVal ) {
433
+ if (! valueEquals (val, oldVal)) {
434
+ this .dispatch (' ElFormItem' , ' el.form.change' , val);
435
+ }
431
436
}
432
437
},
433
438
@@ -894,7 +899,6 @@ export default {
894
899
// determine user real change only
895
900
if (! valueEquals (val, this .valueOnOpen )) {
896
901
this .$emit (' change' , val);
897
- this .dispatch (' ElFormItem' , ' el.form.change' , val);
898
902
this .valueOnOpen = val;
899
903
}
900
904
},
Original file line number Diff line number Diff line change @@ -483,11 +483,11 @@ describe('Form', () => {
483
483
expect ( valid ) . to . not . true ;
484
484
setTimeout ( _ => {
485
485
expect ( field . validateMessage ) . to . equal ( '请选择日期' ) ;
486
- // programatic modification does not trigger change
487
- vm . value = new Date ( ) ;
486
+ // programatic modification triggers change validation
487
+ vm . form . date = new Date ( ) ;
488
488
setTimeout ( _ => {
489
- expect ( field . validateMessage ) . to . equal ( '请选择日期 ' ) ;
490
- vm . value = '' ;
489
+ expect ( field . validateMessage ) . to . equal ( '' ) ;
490
+ vm . form . date = '' ;
491
491
// user modification triggers change
492
492
const input = vm . $refs . picker . $el . querySelector ( 'input' ) ;
493
493
input . blur ( ) ;
You can’t perform that action at this time.
0 commit comments