标头不同的网页,互相传值 通过内存什么的

+在旧页面要跳转的地方

goHome() {
      window.location.href =
        "http://xxxxxxxxxxxxxxxxxxx/?token=" +
        localStorage.getItem("token") +
        "&username=" +
        localStorage.getItem("username");
    ---------------------------------------我这里的数据是存在本地的所以如上
    },
mounted() {
    const params = new URLSearchParams(window.location.search);
    const token = params.get("token");
    const username = params.get("username");
    }
可以通过xxx.get("x")获取到你url上面附带的内容
posted @ 2022-11-07 17:42  zongkm  阅读(17)  评论(0)    收藏  举报