最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Read URL query param values (Vue.js) - Stack Overflow

programmeradmin3浏览0评论

In vuejs callback URL I've some parameter value and I need to read this param value. For example the return url is: http://localhost:8080/#/sucesspage?encryteddata=abdeshfkkilkalidfel&9a

I have tried this.$route.query.encryteddata but I'm got null value.

Is there any way to get the param value in vuejs?

In vuejs callback URL I've some parameter value and I need to read this param value. For example the return url is: http://localhost:8080/#/sucesspage?encryteddata=abdeshfkkilkalidfel&9a

I have tried this.$route.query.encryteddata but I'm got null value.

Is there any way to get the param value in vuejs?

Share Improve this question edited Oct 7, 2021 at 16:47 Super Kai - Kazuya Ito 1 asked Oct 1, 2018 at 8:54 RajeshRajesh 951 gold badge2 silver badges10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 21

You should understand that Route Queries and Route Params in Vue are 2 different things. You declare Route params in your Router for example www.example.com/30 = /:id, then you can get that data via this.$route.params.id

The Url Queries usually look like www.example.com/hello?visible=false and you can grab those with

let urlParams = new URLSearchParams(window.location.search);
let myParam = urlParams.get('visible');

You can also combine these 2: for example getting on the Article with the ID of 30 while having a query telling you some other additional info. /30?visible=false

发布评论

评论列表(0)

  1. 暂无评论