Skip to content

Commit

Permalink
fix: modelValue と maxHeight の変更時に autosize.update を呼び出すように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
reiroop committed Feb 2, 2025
1 parent 9efd8cb commit 71532ed
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/components/UI/TextareaAutosize.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</template>

<script lang="ts" setup>
import autosize from 'autosize'
import { nextTick, onBeforeUnmount, onMounted, ref, toRef, watch } from 'vue'
import useTextModelSyncer from '/@/composables/useTextModelSyncer'
import autosize from 'autosize';
import { nextTick, onBeforeUnmount, onMounted, ref, toRef, watch } from 'vue';
import useTextModelSyncer from '/@/composables/useTextModelSyncer';
const props = defineProps<{
modelValue: string
Expand Down Expand Up @@ -54,7 +54,7 @@ onMounted(() => {
autosize(textareaEle.value)
}
})
watch(toRef(props, 'modelValue'), async () => {
watch([toRef(props, 'modelValue'), toRef(props, 'maxHeight')], async () => {
await nextTick()
if (textareaEle.value) {
autosize.update(textareaEle.value)
Expand All @@ -69,13 +69,6 @@ onBeforeUnmount(() => {
defineExpose({
focus
})
watch(toRef(props, 'maxHeight'), async () => {
await nextTick()
if (textareaEle.value) {
autosize.update(textareaEle.value)
}
})
</script>

<style lang="scss" module>
Expand Down

0 comments on commit 71532ed

Please sign in to comment.