What is the difference between $route.params and $route.query in the vue-router project? summarize the trampling incident.

Today, I stepped on a big hole in the difference between $route.params and $route.query.
when entering the list page, it appears as follows:


it is obvious that the location where the arrow points is not highlighted in the first picture. Why?

? I don"t know if other friends have stepped on this place. Please leave a message here

.
Mar.06,2021

well, the problem was solved quickly with the help of colleagues;

-split line-

consider the question: under what circumstances should a highlight appear at the bottom of the tab tab?

after looking at the data, the sentence is given: when the destination route is successfully activated, the link element automatically sets a CSS class name that represents the activation. Thus, the problem occurs because the destination route is not successfully activated

the destination route should actually look like this:

?accesstoken=1234

:

:

well, the highlight at the bottom of the tab tab will display normally again!

think about the question: why does changing query to params make the route display correctly? It depends on the difference between $route.params and $route.query

what they have in common: are all for passing parameters when the interface jumps

differences:

(1) receive parameters,
query and route are this.$route.params.accesstoken, this.$route.params.accesstoken,. Note: $route instead of $router.
(2) display in the browser address bar
use the query parameter to display in the browser address bar, but when using params, the parameter will not be displayed in the address bar. It can be understood that query is more like the get method in ajax, while params is more similar to the post method

.

-split line-

but,

when we use the post-params, we can only get the token, to refresh the page for the first time or never get the token after the page jumps.

what is the reason?

originally: when you use params to pass parameters, when you jump to another page or refresh the page, the parameters will be lost

solution?

cookie, vuex


there are many typos.


I remember that the page is gone as soon as the parameters are passed through params, and the refresh after the url is displayed through query will not affect


the difference between the parameter names of path on your route and those passed by params


the corresponding route in router.js is set as follows, so that there is no parameter loss after refresh

path: 'equipment/:id',
Menu