2020-02-13 12:55:00 +01:00
|
|
|
<template>
|
2020-02-28 15:21:12 +01:00
|
|
|
<div class="field" :class="{ 'with-offset' : hasOffset }">
|
2020-02-13 12:55:00 +01:00
|
|
|
<label class="label" v-html="label"></label>
|
|
|
|
<div class="control">
|
2022-07-07 11:46:25 +02:00
|
|
|
<input :disabled="isDisabled" :id="fieldName" :type="inputType" class="input" v-model="form[fieldName]" :placeholder="placeholder" v-bind="$attrs" />
|
2020-02-13 12:55:00 +01:00
|
|
|
</div>
|
|
|
|
<field-error :form="form" :field="fieldName" />
|
2020-02-13 16:23:49 +01:00
|
|
|
<p class="help" v-html="help" v-if="help"></p>
|
2020-02-13 12:55:00 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'FormField',
|
|
|
|
inheritAttrs: false,
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
|
|
|
|
fieldName: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
|
|
|
|
inputType: {
|
|
|
|
type: String,
|
|
|
|
default: 'text'
|
|
|
|
},
|
|
|
|
|
|
|
|
form: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
|
|
|
|
placeholder: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
2020-02-13 16:23:49 +01:00
|
|
|
|
|
|
|
help: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
2020-02-28 15:21:12 +01:00
|
|
|
|
|
|
|
hasOffset: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
2022-07-07 11:46:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
isDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
2020-02-28 15:21:12 +01:00
|
|
|
}
|
2020-02-13 12:55:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|