Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Input/Textarea): add v-model modifiers #856

Merged
merged 8 commits into from
Nov 10, 2023

Conversation

maxsteinwand
Copy link
Contributor

πŸ”— Linked issue

Resolves #853

❓ 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

Implements the v-model modifiers for UInput and UTextarea. Possible modifiers are .lazy .number and .trim v-model docs

.lazy will update the modelValue onChange
.number will return the value as typeof number (if parseable) the function to parse a number is from the offical vue repo.
.trim will trim the string

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly. (No changes needed)

@vercel
Copy link

vercel bot commented Oct 24, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui βœ… Ready (Inspect) Visit Preview Nov 7, 2023 6:43pm

@maxsteinwand maxsteinwand changed the title <fix>(Input/Textarea) add v-model properties <fix>(Input/Textarea) add v-model modifiers Oct 24, 2023
src/runtime/components/forms/Textarea.vue Outdated Show resolved Hide resolved
src/runtime/components/forms/Textarea.vue Outdated Show resolved Hide resolved
src/runtime/components/forms/Input.vue Outdated Show resolved Hide resolved
src/runtime/components/forms/Input.vue Outdated Show resolved Hide resolved
Autoresize in onInput without .lazy
@maxsteinwand
Copy link
Contributor Author

@benjamincanac this is ready to merge or another QA if you want

@benjamincanac
Copy link
Member

I'm not sure to understand why we need to do this, the default .trim, .number and .lazy modifiers should work out of the box πŸ€”

@maxsteinwand
Copy link
Contributor Author

maxsteinwand commented Nov 2, 2023

Check the Issue that is linked. The .lazy will not work as in UInput you update the value @ input and no @ change event is implemented. As the native v-model.lazy will transpile into :value and @ change. Number works but the native input has the behaviour of applying the .number modifier if you do type="number". Trim and default .number behaviour will work, just added them for completion.

Copy link
Member

Ok got it, thanks for the explanation! Will review this asap 😊

@benjamincanac benjamincanac changed the title <fix>(Input/Textarea) add v-model modifiers fix(Input/Textarea): add v-model modifiers Nov 10, 2023
@benjamincanac benjamincanac merged commit 68f6956 into nuxt:dev Nov 10, 2023
2 checks passed
@benjamincanac
Copy link
Member

Thanks! 😊

@maxsteinwand maxsteinwand deleted the fix/vModelProperties branch November 10, 2023 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UInput lazy modifier ignored
3 participants