Vue uses keep-alive for page caching, modifies the next page, and then clicks to jump to the previous page, the page data is not refreshed.

as shown in the figure: delete a group on the grouping page, then click on the device management page, or click back to the previous page (device management page)

clipboard.png

clipboard.png
this needs to be refreshed. If the grouping page does nothing, jump to the device management page to use the page"s cache.

the current way to handle this is to define a global variable first, give the variable true, as long as you operate on the grouping in a page, and then do so in the beforeRouteLeave hook function.
beforeRouteLeave (to, from, next) {

if (this.flagKeepAlive==true&&to.path=="/device") {
  to.meta.keepAlive = false;
} 
else {
  to.meta.keepAlive = true;
}
next();

}

Apr.17,2021

call the refresh method of the current data in the activated () method.

Menu