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

feat(Tabs): add before-change event #3493

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

alexovn
Copy link

@alexovn alexovn commented Mar 8, 2025

❓ 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

This PR introduces a new @before-change event for the Tabs component, allowing code execution before the @change event is triggered. This is useful in scenarios where data validation is required before switching tabs or when preventing (or resolving) the next @change event handling.

Under the hood, it uses a Promise object with the resolve() method, which is passed to the before-change event emitter. This allows it to be invoked when needed to resolve the next @change event handling.

Example: Verify that form data in a tab has been properly saved before switching to another tab, and display a confirmation window with a relevant message to users.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@alexovn alexovn force-pushed the feat/add-before-change-event-to-tabs branch from 6e58767 to b1f6275 Compare March 10, 2025 07:30
Copy link

pkg-pr-new bot commented Mar 10, 2025

npm i https://pkg.pr.new/@nuxt/ui@3493

commit: b1f6275

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.

1 participant