forked from vue-generators/vue-form-generator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfieldUpload.vue
44 lines (41 loc) · 885 Bytes
/
fieldUpload.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<template lang="pug">
.wrapper(v-attributes="'wrapper'")
input.form-control(
:id="fieldID",
type="file",
:name="inputName",
@change="onChange",
:accept="fieldOptions.accept",
:multiple="fieldOptions.multiple",
:placeholder="placeholder",
:readonly="readonly",
:required="schema.required",
:disabled="disabled",
v-attributes="'input'")
</template>
<script>
import abstractField from "../abstractField";
import { isFunction } from "lodash";
export default {
name: "field-upload",
mixins: [abstractField],
methods: {
onChange($event) {
if (isFunction(this.schema.onChanged)) {
// Schema has defined onChange method.
this.schema.onChanged.call(this, this.model, this.schema, $event, this);
}
}
}
};
</script>
<style lang="scss">
.vue-form-generator .field-input {
.wrapper {
width: 100%;
}
.helper {
margin: auto 0.5em;
}
}
</style>