the current route, such as / search
, I want to jump to / search?p=1
. The first thought on the home page is to read this.$route.query
, and then modify p
to achieve the jump,
but the following push
methods in my project do not jump to the url I thought of
let newQuery = this.$route.query //query
newQuery.p = val //
let routeParam={
query: newQuery
}
this.$router.push(routeParam)
I think the above problem may be that I don"t know about vue-router
, so I don"t know what"s wrong, but the strange thing is that the following code successfully jumps to the url, I want. I print out routeParam
to see if there"s any difference
let newQuery = {}
newQuery.p = val
let routeParam={
query: newQuery
}
this.$router.push(routeParam)
in fact, I want to change more than just the p
parameter, so I read this.$route.query
every time, and then modify
, but I don"t understand the problem above, am I missing any details?