Vue refreshes the current page, 11 choose 5 platform maintenance
In the vue management background, there are often additions, deletions, changes and queries in the form of 11-option 5 platform maintenance (enterprise E: 1793 408). After the modification, you have to refresh the page or adjust the method, but in the permissions menu role page, if you change the permissions of the account you are currently logged in, you need to refresh globally. However, many methods are not on the current page, so it is troublesome. If you use this.$router.go (0), it will force the refresh to be ugly. So you have to allow an ancestral component to inject a dependency into all its descendants, no matter how deep the component level is, and it always takes effect when the upstream and downstream relationship is established.
1. In the root component APP.vue, the refresh method is written, and the initial state of the route is displayed.
Export default {
Name: 'App'
Provide () {
Return {
Reload:this.reload
}
}
Data () {
Return {
IsRouterAlive:true
}
}
Methods: {
Reload () {
This.isRouterAlive = false
This.$nextTick (function () {
This.isRouterAlive = true
})
}
}
Components: {
}
}