In my Vue project, I am using the replace
method to add a query
to the current URL. If the value is not present, I'm assigning undefined
.
this.$router.replace({
name: "admin-frs",
query: {
limit: this.pageSize,
page: this.currentPage,
sort: this.sortbyapi || undefined,
language: this.sortbyapiLang || undefined,
},
})
This approach causes the query item to disappear from the URL when the query data is updated, but it does not remove it from the query object itself.
I'm wondering if there may be a better way to handle this situation. Additionally, I'm curious if it's possible to retrieve the query as it appears in the route, like &limit=10...etc
.