Commit b0db2f7 chenwenhao
committed May 31, 2024 · 1 / 1
1 parent 1064425 commit b0db2f7 Copy full SHA for b0db2f7
File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,8 @@ export function registerOptionsControl(config: OptionsConfig) {
434
434
formItem . loadOptionsFromDataScope (
435
435
props . source as string ,
436
436
props . data ,
437
- this . changeOptionValue
437
+ this . changeOptionValue ,
438
+ true
438
439
) ;
439
440
440
441
this . normalizeValue ( ) ;
Original file line number Diff line number Diff line change @@ -866,7 +866,12 @@ export const FormItemStore = StoreNode.named('FormItemStore')
866
866
function loadOptionsFromDataScope (
867
867
source : string ,
868
868
ctx : Record < string , any > ,
869
- onChange ?: ( value : any ) => void
869
+ onChange ?: (
870
+ value : any ,
871
+ submitOnChange ?: boolean ,
872
+ changeImmediately ?: boolean
873
+ ) => void ,
874
+ clearValue ?: boolean
870
875
) {
871
876
let options : any [ ] = resolveVariableAndFilter ( source , ctx , '| raw' ) ;
872
877
@@ -892,6 +897,13 @@ export const FormItemStore = StoreNode.named('FormItemStore')
892
897
893
898
setOptions ( options , onChange , ctx ) ;
894
899
900
+ // source从数据域获取,同时发生变化时,需要清空当前表单项
901
+ if ( clearValue && ! self . selectFirst ) {
902
+ self . selectedOptions . some ( ( item : any ) => item . __unmatched ) &&
903
+ onChange &&
904
+ onChange ( '' , false , true ) ;
905
+ }
906
+
895
907
return options ;
896
908
}
897
909
You can’t perform that action at this time.
0 commit comments