Vue routing this.route.push jump page does not refresh1. BackgroundIntroduction: In the development of Vue projects, when using routing to jump to a page, the page to which the routing jumps is not refreshed. That is, the vue life cycle function is not executed (created, mounted hook functions). Examples: Page A: Page B: question: When you first click the button on page A to go to page B, everything is normal. When you return to page A and click the button again, page B does not execute the mounted hook function, resulting in the query method in the mounted function not being executed. 2. Solution:1. Use the activated:{} periodic function instead of the mounted:{} function. 2. Monitoring Routes // Not recommended, poor user experiencewatch: { '$route' (to, from) { // The page refreshes when the route changes this.$router.go(0); } }, // This method will request watch once more: { '$route' (to, from) { // The method executed in the mounted function, put it here this.qBankId = globalVariable.questionBankId; this.qBankName = globalVariable.questionBankTitle; this.searchCharpter(); } }, Vue this.$router.push route jump, refresh parameters disappearthis.$router.push({name:"",params:{id:""}}) name and params will disappear when refresh parameters are matched this.$router.push({path:"",query:{id:""}}) Path and query are used together. The parameters will not disappear when the page is refreshed. The parameters in the query become part of the URL. The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of the solution to Ubuntu dual system stuck when starting
>>: Navicat for MySql Visual Import CSV File
The W3C standardization process is divided into 7...
XML Schema is an XML-based alternative to DTD. XM...
Example source code: https://codepen.io/shadeed/p...
Server placement It is recommended to use cloud s...
Introduction Use simple jQuery+CSS to create a cus...
During the development process, I often encounter...
Over a period of time, I found that many people d...
When href is needed to pass parameters, and the p...
1. Common usage: (1) Use with % % represents a wi...
Table of contents mysql log files binlog Binlog l...
[Required] UserInterface PhotoShop/Fireworks Desi...
Without going into details, let's go straight...
In an article a long time ago, I talked about the...
MySQL has multiple ways to import multiple .sql f...
If there are files that are being used by a proce...