Monitor all page routing parameters in vue

1. Use watch function in app.vue

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

 

Guess you like

Origin blog.csdn.net/wei80231996/article/details/114268548