Skip to content

docs(vue): recommend passing URL parameters as props instead of useRoute#4515

Open
ShaneK wants to merge 1 commit into
mainfrom
FW-6947
Open

docs(vue): recommend passing URL parameters as props instead of useRoute#4515
ShaneK wants to merge 1 commit into
mainfrom
FW-6947

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented May 22, 2026

resolves #1945

What is the current behavior?

The URL Parameters section in docs/vue/navigation.md reads route params by calling useRoute() in <script setup> and destructuring route.params.id. That couples the component to the router instance, which Vue Router's own docs discourage and which makes the component harder to reuse or test in isolation.

What is the new behavior?

The example now uses props: true on the route record and defineProps<{ id: string }>() in the component, mirroring Vue Router's recommended pattern. The intro recommends the props approach up front, and the closing line calls out that the component has no router dependency.

The same change is also backported to the v7 docs.

@ShaneK ShaneK requested a review from a team as a code owner May 22, 2026 21:44
@ShaneK ShaneK requested a review from OS-jacobbell May 22, 2026 21:44
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview, Comment May 22, 2026 9:45pm

Request Review

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.

Using router in Vue components is discouraged

1 participant