vue single-page application without a sense refresh the current page

Refresh the current page commonly used method is:

The first method is:

`window.reload();`

The second method is:

this.$router.go(0);

Both methods can refresh the current surface, but refresh the moment, there will be a moment flashes blank page; so the user experience is not good.

Today to introduce a third method:

Use proviceand injectincorporated methods. This method really effective, there will be no flashing appears blank. as follows:

At the outset of this method in App.vue components, the wording is as follows:
Here Insert Picture Description
Here Insert Picture Description
Then you want to refresh the page components of the current page to call this method:
Here Insert Picture Description
Here Insert Picture Description

Published 10 original articles · won praise 0 · Views 1570

Guess you like

Origin blog.csdn.net/weixin_45266779/article/details/104431561