pingcrm/resources/js/Shared/TextareaInput.vue

33 lines
703 B
Vue
Raw Normal View History

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