vue中用watch监听路由信息

$route为当前跳转路由
可以通过$router来拿到 $router.path $router.query $router.path

watch: {
    '$route.params.keyWords': {
      handler (newVal) {
        console.log(newVal)
      },
      immediate: true,
      deep: true
    }
  }
发布了151 篇原创文章 · 获赞 1 · 访问量 1835

猜你喜欢

转载自blog.csdn.net/qq_45802159/article/details/104321884