Skip to content

Commit

Permalink
fix(useTextareaAutosize): onResize callback fires not only on resize (#…
Browse files Browse the repository at this point in the history
…3887)

Co-authored-by: banruo <shl@dataqin.com>
  • Loading branch information
huiliangShen and banruo committed May 27, 2024
1 parent 424a204 commit a6ede83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/useTextareaAutosize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export function useTextareaAutosize(options?: UseTextareaAutosizeOptions) {
height = `${textareaScrollHeight.value}px`

textarea.value.style[styleProp] = height

options?.onResize?.()
}

watch([input, textarea], () => nextTick(triggerResize), { immediate: true })

watch(textareaScrollHeight, () => options?.onResize?.())

useResizeObserver(textarea, () => triggerResize())

if (options?.watch)
Expand Down

0 comments on commit a6ede83

Please sign in to comment.