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
Table of contents 1. Introduction 2. JDBC impleme...
Table of contents 01. Use useState when render is...
Each web page has an address, identified by a URL...
If you forget your MySQL login password, the solu...
Table of contents 1. What is Docker Compose? 2. D...
MySQL's MyISAM and InnoDB engines both use B+...
I am a beginner in SQL and thought that the insta...
Preface In MySQL, both Innodb and MyIsam use B+ t...
In CSS, element tags are divided into two categor...
To use standard CSS3 to achieve the shadow effect...
First, let’s take an example: There is a type fie...
MySQL 5.7.9 version sql_mode=only_full_group_by i...
Table of contents Preface $attrs example: $listen...
Preface Engineers working in the Linux environmen...
Preface Recently, I took over a client's nati...