-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestTaskTextArea.vue
More file actions
36 lines (32 loc) · 1.22 KB
/
RequestTaskTextArea.vue
File metadata and controls
36 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<template>
<div class="flex flex-col gap-1.5 relative">
<div class="text-xs flex gap-x-1 text-red-1">
<p class="text-body text-xs font-semibold">부가설명</p>
<p v-if="isInvalidateState === 'description'">부가설명은 1000자 이내로 적어주세요</p>
</div>
<textarea
class="w-full h-32 border border-border-1 px-4 py-2 resize-none focus:outline-none rounded"
:value="modelValue"
:placeholder="placeholderText"
:maxlength="1000"
@input="updateValue(($event.target as HTMLInputElement).value)">
</textarea>
<p
v-if="limitLength"
class="absolute text-xs top-[calc(100%+4px)] w-full flex justify-end text-body">
({{ inputLength }}/{{ limitLength }})
</p>
</div>
</template>
<script lang="ts" setup>
import type { RequestTaskTextAreaProps } from '@/types/user'
import { computed } from 'vue'
const { modelValue, placeholderText, isInvalidate, limitLength } =
defineProps<RequestTaskTextAreaProps>()
const emit = defineEmits(['update:modelValue'])
const isInvalidateState = computed(() => isInvalidate)
const updateValue = (value: string) => {
emit('update:modelValue', value)
}
const inputLength = computed(() => modelValue.length)
</script>