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

Cannot watch for changes in route query parameters using useRoute() #3908

Open
4 tasks done
g-dx opened this issue May 20, 2024 · 1 comment
Open
4 tasks done

Cannot watch for changes in route query parameters using useRoute() #3908

g-dx opened this issue May 20, 2024 · 1 comment
Labels
enhancement New feature or request has-workaround Has workaround, low priority

Comments

@g-dx
Copy link
Contributor

g-dx commented May 20, 2024

Is your feature request related to a problem? Please describe.

I'd like to write the following code on one of my VitePress pages:

<script setup>
import { useRoute } from 'vitepress';
import { watch } from 'vue';

const route = useRoute();

watch(route.query, (newQuery) => {
  // Do something....
});
</script>

However, the current useRoute() object does not provide access to query parameter information.

Describe the solution you'd like

I'd like to be able to access the search property of the current location as is possible in vue-router:

https://router.vuejs.org/api/interfaces/RouteLocationNormalizedLoaded.html#query

Describe alternatives you've considered

No response

Additional context

No response

Validations

@brc-dd
Copy link
Member

brc-dd commented May 20, 2024

use useUrlSearchParams from vueuse instead

@brc-dd brc-dd added has-workaround Has workaround, low priority enhancement New feature or request labels Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request has-workaround Has workaround, low priority
Projects
None yet
Development

No branches or pull requests

2 participants