If you want to delete or add a record, you may want to refresh the current page.

The current http://localhost:9530/#/supplier/supplierAll page can be refreshed if you want to click OK while the Dialog Dialog closes

The data for the table can then be reloaded, and the data set for the Dialog Dialog box can be refreshed to appear on the page after confirmation

At this point, our most immediate thinking is to think of the following:

Router router router router router router router router router router router

Here I sort out several commendable three ways, you can choose:

1, the most direct whole page refresh:

location. reload()


this.$router.go(0)

Both of these can refresh the current page, the disadvantage is equivalent to pressing CTRL +F5 forced refresh that, the whole page reload, there will be a moment of blank page, bad experience

2. Create a blank page supplierallBack. vue, click OK to go to the blank page, and then immediately go back

Content in supplierallBack. vue

This way, compared with the first will not appear a moment of blank page, but the address bar has a fast switching process, can be used

3, provide/inject combination method is the most practical I have tried, the following uses the project screenshot to illustrate: First, to modify your app. Vue

Control the reloading of the page by declaring the reload method to display or hide the router-view, as defined here

IsRouterAlive //true or false to control

Then inject the Reload dependency provided by the app.vue component into the page that needs the current page refresh, and call it directly with this.reload

conclusion

The above is xiaobian to introduce the vUE project to refresh the current page of the three methods, I hope to help you, if you have any questions please leave a message to me, xiaobian will reply to you in time. Thank you very much for your support to the script Home website!

Articles you may be interested in:

  • Fix vue this.$forceUpdate() handling page refresh (v-for loop value refresh, etc.)
  • How does the VUE project refresh the current page
  • Router. push cannot refresh the page in Vue-Router3.0
  • Use sessionStorage to solve the problem of vuex data being wiped after page refresh
  • Solve the problem of missing vUE page refresh or back parameters
  • Vue single page using keep-alive page return does not refresh
  • Resolve the problem that data on the VUE routing change page is not refreshed