vue-router参数query改变页面url不改变及不更新数据
路由本身有query参数,但是我点击更新了query,也push了,页面url不改变,这个时候其实用到了对象的拷贝,你需要对query对象做拷贝,对象的深拷贝和浅拷贝 let query = this.$router.history.current.query; let path = this.$router.history.current.path; //对象的拷贝 let newQuery = JSON.parse(JSON.stringify(query)); newQuery.pid = pid; this.$router.push({ path, query: newQuery }); 以上只是其中一种,至于对象的深拷贝浅拷贝需要自己整理一下 来源: CSDN 作者: RXpro0908 链接: https://blog.csdn.net/qq_46028949/article/details/104340481