Expose autoResize in Textarea.vue by Ken-vdE · Pull Request #6120 · nuxt/ui
Be able to call autoResize without forcefully triggering an Input (which could have other functional implications e.g. making api requests on input events).
❓ Type of change
- 📖 Documentation (updates to the documentation or readme)
- 🐞 Bug fix (a non-breaking change that fixes an issue)
- 👌 Enhancement (improving an existing functionality)
- ✨ New feature (a non-breaking change that adds functionality)
- 🧹 Chore (updates to the build process or auxiliary tools and libraries)
- ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
Say you have a Textarea containing text and the window is resized; the autoResize will not be triggered (there are other cases too).
This change will allow you to do something like this:
const resizeDebouncer = useDebounceFn(() => { textareaTemplateRef.value.autoResize(); }, 500); onMounted(() => { window.addEventListener('resize', resizeDebouncer); }); onUnmounted(() => { window.removeEventListener('resize', resizeDebouncer); });
Without manually triggering, say, an input event, which could have other implications when using a manual @update:modelValue"...".
📝 Checklist
- I have linked an issue or discussion.
- I have updated the documentation accordingly.