vue 修改当前路由参数并刷新界面
项目中经常用到的需求是在当前页面修改路由中的参数,并刷新页面。
我们只用this. r o u t e r . r e p l a c e 或者 t h i s . router.replace或者this. router.replace或者this.router.go是不行的,需配合下面的代码
方法一:
this.$router.replace({name: 'Home',query: {name: '123'}})/ 刷新当前界面,这个不兼容低版本的谷歌浏览器 */this.$router.go(0)
方法二:
this.$router.replace({name: 'Home',query: {name: '123'}})/ 兼容性好*/window.location.reload()