In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you how to solve the vuejs route push does not jump the problem, I hope you have something to gain after reading this article, let's discuss it together!
vuejs route push does not jump to the solution: 1, open vue-router jump code part of the content;2, add "watch: {'$route' (to, from) {...}, "Method;3. Monitor router changes and refresh the page.
Operating environment: Windows 7 system, vue2.9.6 version, DELL G3 computer.
How to solve the problem of vuejs route push not jumping?
vue-router with routing $router.push not jump A simple solution
Vue-router jump is usually written like this:
toCurrentPage: function(thisId){ this.$ router.push({path:'/test ', query: { id: thisId, option: ""}}); }
However, when you encounter a situation where you need to jump to a different query on the same page, the above method does not work. Of course, from a performance point of view, the theoretically best solution for this situation is to wrap the refresh into an init function, jump to the method, and pass the parameter to call the init method again. Balabalabala... not to repeat.
But in other cases, all components of the basic page need to be refreshed. Loading again has little impact on the overhead. You need history.back to ensure smooth operation logic... We only need to jump to load this, so it is actually very simple. Just add:
watch: { '$route' (to, from) { this.$ router.go(0); }},
Monitor router changes, refresh page ~
After reading this article, I believe you have a certain understanding of "how to solve the problem of vuejs route push not jumping". If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.