2020-05-31 10:46:22 +00:00
|
|
|
<template>
|
|
|
|
<label>
|
|
|
|
<span v-if="label">{{ label }}</span>
|
|
|
|
<input
|
|
|
|
:value="value"
|
|
|
|
:type="type"
|
|
|
|
:placeholder="placeholder"
|
2021-09-30 16:37:20 +00:00
|
|
|
:readonly="readonly"
|
2022-06-07 12:03:33 +00:00
|
|
|
:style="styles"
|
2020-05-31 10:46:22 +00:00
|
|
|
@input="onChange"
|
2020-12-21 08:35:19 +00:00
|
|
|
@blur="onBlur"
|
2020-05-31 10:46:22 +00:00
|
|
|
/>
|
2022-06-10 13:59:52 +00:00
|
|
|
<p v-if="helpText" class="help-text" />
|
2020-12-21 08:35:19 +00:00
|
|
|
<span v-if="error" class="message">
|
|
|
|
{{ error }}
|
|
|
|
</span>
|
2020-05-31 10:46:22 +00:00
|
|
|
</label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
type: [String, Number],
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'text',
|
|
|
|
},
|
|
|
|
placeholder: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
helpText: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-12-21 08:35:19 +00:00
|
|
|
error: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-09-30 16:37:20 +00:00
|
|
|
readonly: {
|
|
|
|
type: Boolean,
|
|
|
|
deafaut: false,
|
|
|
|
},
|
2022-06-07 12:03:33 +00:00
|
|
|
styles: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2020-05-31 10:46:22 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange(e) {
|
|
|
|
this.$emit('input', e.target.value);
|
|
|
|
},
|
2020-12-21 08:35:19 +00:00
|
|
|
onBlur(e) {
|
|
|
|
this.$emit('blur', e.target.value);
|
|
|
|
},
|
2020-05-31 10:46:22 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|