audiobookshelf/client/components/ui/TextareaWithLabel.vue

42 lines
813 B
Vue
Raw Normal View History

2021-08-18 00:01:11 +02:00
<template>
<div class="w-full">
<p class="px-1 text-sm font-semibold" :class="disabled ? 'text-gray-400' : ''">{{ label }}</p>
2023-06-25 23:16:11 +02:00
<ui-textarea-input ref="input" v-model="inputValue" :disabled="disabled" :readonly="readonly" :rows="rows" class="w-full" />
2021-08-18 00:01:11 +02:00
</div>
</template>
<script>
export default {
props: {
value: [String, Number],
label: String,
disabled: Boolean,
2023-06-25 23:16:11 +02:00
readonly: Boolean,
2021-08-18 00:01:11 +02:00
rows: {
type: Number,
default: 2
}
},
data() {
return {}
},
computed: {
inputValue: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
methods: {
blur() {
if (this.$refs.input && this.$refs.input.blur) {
this.$refs.input.blur()
}
}
},
2021-08-18 00:01:11 +02:00
mounted() {}
}
</script>