vue中监听所有页面路由传参

1.在app.vue中使用watch函数

watch: {//和methods同级
    $route() {
      console.log(window.location.href, "页面参数");
      //如果要存入使用的和接收的话
      sessionStorage.setItem("token",this.$route.query.token)//token假设参数中有token参数
    },
  },

猜你喜欢

转载自blog.csdn.net/wei80231996/article/details/114268548
今日推荐