vue2.0 watch route

watch: {
    $route: function(newRouter,oldRouter) {
      console.log(newRouter)
      //{fullPath:"/goods/goodslist",
      //hash:{},
      //meta:{},
      //name:"goodslist",
      //params:{},
      //path:"/goods/goodslist",
      //query:{}
      //}
      this.activeIndex = newRouter.path//侧边栏选中
      }
    }
  }

你可能感兴趣的:(vue2.0 watch route)