Categories
Vue Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *