首页 > 技术文章 > 关于Vue中,$this.router.push到当前页面,只是传入参数不同,页面不刷新的问题解决

jane2160 2019-09-23 16:58 原文

 

 

在页面的watch中,监听$router的变化

watch: {
    $route (to, from) {
      this.$router.go(0)
    }
  }

其中this.$router.go(0)为刷新页面,但此方法可能在Safari中无法实现,还可以用js原生的方法:window.location.reload()

推荐阅读