Vue刷新当前页面

122 阅读1分钟

方法1:

window.reload();

方法2:

this.$router.go(0);

这两种方法是可以刷新当前面,但刷新的那一瞬间,页面会有一瞬间空白闪烁 

方法3:

使用provice和inject结合的方法。此方法着实有效,不会有闪烁的空白出现。 

image.png

  image.png

在需要刷新的页面进行调用

Inject:['reload']

this.reload()

image.png