Pass URL query params to href
I have a button with a link that looks like this
I want to read all the query params from this page and pass them along to this
href
.
I tried something like
However, the URLSearchParams
doesn't take a LocationQuery
(that is being return from route.query
).
What's the best way to sort this out?5 Replies
you could use ufo's utils instead of URLSearchParams.toString()
GitHub
GitHub - unjs/ufo: π URL utils for humans
π URL utils for humans. Contribute to unjs/ufo development by creating an account on GitHub.
Thanks. If I can, however, I'd like to avoid using another library just for this use case
Actually, seems like I don't need to install it.
This seemed to have worked.
that's already part of nuxt π
Pretty cool, didn't know. Thanks