Skip to content

Commit

Permalink
Improve onChange in file field.
Browse files Browse the repository at this point in the history
  • Loading branch information
hansi90 committed Oct 12, 2017
1 parent daefe38 commit b0baf00
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/fields/core/fieldFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id="getFieldID(schema)",
type="file",
:name="schema.inputName",
@change="schema.onChange || null",
@change="onChange",
:accept="schema.accept",
:multiple="schema.multiple",
:placeholder="schema.placeholder",
Expand All @@ -15,9 +15,18 @@

<script>
import abstractField from "../abstractField";
import { isFunction } from "lodash";
export default {
mixins: [abstractField]
mixins: [abstractField],
methods: {
onChange(){
if(isFunction(this.schema.onChanged)){
// Schema has defined onChange method.
this.schema.onChanged.call(this, this.model, this.schema, event, this);
}
}
}
};
</script>
Expand Down

0 comments on commit b0baf00

Please sign in to comment.