Files
thetool/public/plugins/vue/tt-components/tt-textarea.js
2024-05-08 12:54:26 +00:00

29 lines
685 B
JavaScript

Vue.component('tt-textarea', {
props: {
label: String,
required: Boolean,
value: String,
rows: {
type: String,
default: "3",
}
},
data() {
return {
currentText: this.value,
};
},
watch: {
value(newValue) {
this.currentText = newValue;
},
},
template: `
<div class="form-group">
<label :for="label">{{ label }}</label>
<textarea class="form-control" :id="label" :required="required" v-model="currentText"
@input="$emit('input', $event.target.value)" :rows="rows"></textarea>
</div>
`
});