@@ -24,7 +24,7 @@ import {
24
24
InputType ,
25
25
} from ' @/core/models' ;
26
26
27
- import { isEmpty , entries , values , keys } from ' @/core/utils/helpers' ;
27
+ import { isEmpty , entries , values , keys , isEvent } from ' @/core/utils/helpers' ;
28
28
import { useInputEvents } from ' @/composables/input-events' ;
29
29
import { dynamicFormsSymbol } from ' @/useApi' ;
30
30
@@ -50,7 +50,7 @@ const props = {
50
50
51
51
export type ControlAttribute <T extends InputType > = {
52
52
control: FormControl <T >;
53
- onChanged : (value : unknown ) => void ;
53
+ onChange : (value : unknown ) => void ;
54
54
};
55
55
56
56
export default defineComponent ({
@@ -66,7 +66,7 @@ export default defineComponent({
66
66
const attributes = computed (() => {
67
67
return {
68
68
control: props ?.control ,
69
- onChanged : valueChange ,
69
+ onChange : valueChange ,
70
70
};
71
71
});
72
72
@@ -142,12 +142,24 @@ export default defineComponent({
142
142
}
143
143
}
144
144
145
- function valueChange(value ) {
145
+ function valueChange($event ) {
146
+ let value;
146
147
const newValue = {};
148
+
149
+ if (isEvent ($event )) {
150
+ $event .stopPropagation ();
151
+ value =
152
+ props .control .type === ' checkbox'
153
+ ? $event .target .checked
154
+ : $event .target .value ;
155
+ } else {
156
+ value = $event ;
157
+ }
158
+
147
159
if (props .control ) {
148
160
newValue [props .control .name ] = value ;
149
161
validate ();
150
- emit (' changed ' , newValue );
162
+ emit (' change ' , newValue );
151
163
}
152
164
}
153
165
0 commit comments