Skip to content

Commit

Permalink
fix: expose textarea element ref
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 30, 2024
1 parent c34ce58 commit 30a0e51
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{{ label }}
</label>
<textarea
ref="textareaRef"
:placeholder="placeholder"
:class="inputClasses"
:disabled="disabled"
Expand All @@ -18,8 +19,7 @@
</template>

<script setup lang="ts">
import { computed, useAttrs } from 'vue'
import type { TextInputTypes } from './types/TextInput'
import { computed, useAttrs, ref } from 'vue'
import debounce from '../utils/debounce'
interface TextareaProps {
Expand All @@ -43,6 +43,7 @@ const props = withDefaults(defineProps<TextareaProps>(), {
const emit = defineEmits(['update:modelValue'])
const attrs = useAttrs()
const textareaRef = ref<HTMLTextAreaElement | null>(null)
const inputClasses = computed(() => {
let sizeClasses = {
Expand Down Expand Up @@ -102,4 +103,6 @@ if (props.debounce) {
let handleChange = (e: Event) => {
emitChange((e.target as HTMLInputElement).value)
}
defineExpose({ el: textareaRef })
</script>

0 comments on commit 30a0e51

Please sign in to comment.