How to get URL query with Vue.js?

Sometimes, we want to get URL query with Vue.js.

In this article, we’ll look at how to get URL query with Vue.js.

How to get URL query with Vue.js?

To get URL query with Vue.js, we can use the this.$route.query property if we have Vue Router.

For instance, we write

this.$route.query.page

to get the page query parameter’s value in our Vue component.

Conclusion

To get URL query with Vue.js, we can use the this.$route.query property if we have Vue Router.