vue路由参数变化页面不刷新问题

vue中同一路由只改变路由参数,页面不刷新。

可以添加路由监听

watch: {
  $route: {
     handler() {
       this.id = this.$route.query.id;
       this.getDetail()
    },
    deep: true,//深度监听,同时也可监听到param参数变化
} }

监听路由参数

watch: {
   $route(){
    this.id= this.$route.query.id
   },
   id() {
    this.detail()
   },
}

 

posted @ 2021-02-28 16:56  Panda的前端笔记  阅读(566)  评论(0)    收藏  举报