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/01 Report--
Today, the editor will share with you how to solve the Vue routing this.route.push jump page without refreshing the relevant knowledge points, the content is detailed, 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, let's take a look at it.
Vue routing this.route.push jump page does not refresh I. background
Introduction: in vue project development, when routing is used for page jump, the page to which the route is redirected will not be refreshed.
That is, vue lifecycle functions are not executed (created, mounted hook functions).
Case study:
A page:
Page B:
Question:
When you first click the button on page A to page B, everything is fine. When you return to page An and click the button again, page B does not execute the mounted hook function. As a result, the query method in the mounted function is not executed.
2. Solution:
1. Use the activated: {} periodic function instead of the mounted: {} function.
2. Listen for routing
/ / not recommended, poor user experience watch: {"$route" (to, from) {/ / routing changes page refresh this.$router.go (0) }}, / / this method will request watch: {"$route" (to, from) {/ / the method executed in the mounted function, put there this.qBankId = globalVariable.questionBankId; this.qBankName = globalVariable.questionBankTitle; this.searchCharpter () }}, Vue this.$router.push route jumps, refresh parameter disappears this.$router.push ({name: ", params: {id:"}})
Refresh parameters will disappear with name and params.
This.$router.push ({path: ", query: {id:"}})
When path and query are matched, the refresh page parameters will not disappear, and the parameters in query become part of url.
These are all the contents of this article entitled "how to solve the problem if the Vue routing this.route.push jump page is not refreshed". Thank you for 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.
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.