Skip to content

Commit b0baf00

Browse files
committed
Improve onChange in file field.
1 parent daefe38 commit b0baf00

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/fields/core/fieldFile.vue

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
id="getFieldID(schema)",
55
type="file",
66
:name="schema.inputName",
7-
@change="schema.onChange || null",
7+
@change="onChange",
88
:accept="schema.accept",
99
:multiple="schema.multiple",
1010
:placeholder="schema.placeholder",
@@ -15,9 +15,18 @@
1515

1616
<script>
1717
import abstractField from "../abstractField";
18+
import { isFunction } from "lodash";
1819
1920
export default {
20-
mixins: [abstractField]
21+
mixins: [abstractField],
22+
methods: {
23+
onChange(){
24+
if(isFunction(this.schema.onChanged)){
25+
// Schema has defined onChange method.
26+
this.schema.onChanged.call(this, this.model, this.schema, event, this);
27+
}
28+
}
29+
}
2130
};
2231
2332
</script>

0 commit comments

Comments
 (0)