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

后端 未结 9 1485
甜味超标
甜味超标 2020-12-12 13:47

How can I fetch query parameters in Vue.js?

E.g. http://somesite.com?test=yay.

Can’t find a way to fetch or do I need to use pure JS or some lib

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 14:28

    As of this date, the correct way according to the dynamic routing docs is:

    this.$route.params.yourProperty
    

    instead of

    this.$route.query.yourProperty
    

提交回复
热议问题