Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to solve the problem of vue-router switching for routing parameters that cannot be changed under the same route

Shulou Source: shulou.com Published: 2022-05-31 12:11:01 10月04日 Update

Today, I would like to share with you the relevant knowledge points about how to solve the problem of vue-router switching in exchange for unchangeable routing parameters under the same route. the content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

Recently, I encountered a problem when writing a project with vue. When I jumped under the same page, the routing address remained the same, and the routing parameters changed. At first, I just took the routing parameters in data and found that I could not get the changed routing parameters at all.

You can write like this:

Watch: {'$route' (to, from) {/ / so you can get the changed parameters, and then execute the corresponding logic after the parameter changes. Console.log (this.$route.query)}} Why VueVue is a friendly, multi-purpose and high-performance JavaScript framework. Using vue can create a code base with more maintainability and testability. Vue allows you to split a web page into reusable components, each of which contains its own HTML, CSS, and JavaScript to render the corresponding place in the web page, so more and more front-end developers use vue.

These are all the contents of the article "how to solve the problem that vue-router can not change the routing parameters under the same route". Thank you for your reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Routing parameters changes knowledge articles content components web pages logic different big code front-end just maintainability address place most that is developers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi Apple MariaDB Linux