forked from mirrors/homebox
stuff
This commit is contained in:
parent
8ece3bd7bf
commit
11dcff450c
15 changed files with 536 additions and 22 deletions
45
frontend/components/Form/TextArea.vue
Normal file
45
frontend/components/Form/TextArea.vue
Normal file
|
@ -0,0 +1,45 @@
|
|||
<template>
|
||||
<div class="form-control">
|
||||
<label class="label">
|
||||
<span class="label-text">{{ label }}</span>
|
||||
</label>
|
||||
<textarea class="textarea textarea-bordered h-24" v-model="value" :placeholder="placeholder" />
|
||||
<label v-if="limit" class="label">
|
||||
<span class="label-text-alt"></span>
|
||||
<span class="label-text-alt"> {{ valueLen }}/{{ limit }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'text',
|
||||
},
|
||||
limit: {
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const value = useVModel(props, 'modelValue', emit);
|
||||
const valueLen = computed(() => {
|
||||
console.log(value.value.length);
|
||||
|
||||
return value.value ? value.value.length : 0;
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue