2019-03-18 08:53:00 -03:00
|
|
|
<template>
|
2021-12-08 12:15:39 -03:00
|
|
|
<div :class="$class">
|
2019-03-18 08:53:00 -03:00
|
|
|
<label v-if="label" class="form-label" :for="id">{{ label }}:</label>
|
2021-12-08 12:15:39 -03:00
|
|
|
<textarea :id="id" ref="input" v-bind="$attrs" class="form-textarea" :class="{ error: error }" :value="modelValue" @input="$emit('update:modelValue', $event.target.value)" />
|
2020-09-08 17:14:52 -03:00
|
|
|
<div v-if="error" class="form-error">{{ error }}</div>
|
2019-03-18 08:53:00 -03:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-12-08 12:15:39 -03:00
|
|
|
import { v4 as uuid } from 'uuid'
|
|
|
|
|
2019-03-18 08:53:00 -03:00
|
|
|
export default {
|
|
|
|
inheritAttrs: false,
|
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
default() {
|
2021-12-08 12:15:39 -03:00
|
|
|
return `textarea-input-${uuid()}`
|
2019-03-18 08:53:00 -03:00
|
|
|
},
|
|
|
|
},
|
2021-12-08 12:15:39 -03:00
|
|
|
class: String,
|
2020-09-08 17:14:52 -03:00
|
|
|
error: String,
|
2021-12-08 12:15:39 -03:00
|
|
|
label: String,
|
|
|
|
modelValue: String,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
$class() {
|
|
|
|
return this.class
|
|
|
|
},
|
2019-03-18 08:53:00 -03:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
focus() {
|
|
|
|
this.$refs.input.focus()
|
|
|
|
},
|
|
|
|
select() {
|
|
|
|
this.$refs.input.select()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|