Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Vue refreshes the current page, 11 choose 5 platform maintenance

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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: {

}

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 202

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report