About getting the parameters after the url question mark

1.
clipboard.png
url

2.
clipboard.png

is there something wrong with me? Ladies and gentlemen

Mar.03,2021

your route is in hash mode, which should be obtained using location.hash .
is already shown in your screenshot, but you don't need to do this at all in vue . You only need to use this.$route.query to get
https://router.vuejs.org/zh-c.


to take a look at the request parameter mode?


is preceded by -sharp , but search cannot be found. This belongs to hash

.

the following method can get

function getHashString(name) {
      var arr = (location.hash || "")
        .substr(location.hash.indexOf("?") + 1)
        .replace(/^\-sharp/, "")
        .split("&");
      var params = {};
      for (var i = 0; i < arr.length; iPP) {
        var data = arr[i].split("=");
        if (data.length == 2 && data[0] == name) {
          return data[1];
        }
      }
      return null;
    }

Why is your url like this? If you want to use hash, you should add clipboard.png


 function getQueryString(name) {
        // var reg=/[?&]([^?&]+)=([^?&]+)/i;
        var reg = new RegExp("(^|\&\?)" + name + "=([^&]*)(&|$)", "i");
        // var r = window.location.href.substr(1).match(reg);
        var r = window.location.href.match(reg);
        if (r != null) {
            return unescape(r[2]);
        } else {
            return null;
        }

console.log (this.$route.query.token)

Menu