1. The data on the routing change page is not refreshed
This happens because the route-dependent params parameter acquisition is written in the created lifecycle. Because of the lazy loading of the route, exiting the page and entering another article page will not run the created component lifecycle, resulting in article data for the first time incoming data
Solution: watch monitors whether the route changes
3. The setInterval routing jump continues to run and is not destroyed in time
For example, some bullet screens and revolving lantern texts, which need to be called regularly, after the route jumps, because the component has been destroyed, but the setInterval has not been destroyed, and the background call continues, the console will continue to report errors. If the calculation is large, If it cannot be cleared in time, it will cause serious page freeze.
Solution: Stop setInterval in the component life cycle beforeDestroy
Introduce in the page that needs to be used: import qs from 'qs'
Use qs:
let postData = qs.stringify({
account: this.account,
pwd: this.pwd
})
Use the FormData class
import axios from 'axios'
let data = new FormData();
data.append('code','1234');
data.append('name','yyyy');
this.axios.post(`${this.$url}/test/testRequest`,data)
.then(res=>{
console.log('res=>',res);
})