How to get query parameters from a URL in Vue.js?

Sometimes, we want to get query parameters from a URL in Vue.js.

In this article, we’ll look at how to get query parameters from a URL in Vue.js.

How to get query parameters from a URL in Vue.js?

To get query parameters from a URL in Vue.js, we can use the this.$route.query property in a component.

For instance, we write

this.$route.query.test

to get the value of the test query parameter from a query string.

Conclusion

To get query parameters from a URL in Vue.js, we can use the this.$route.query property in a component.