zoukankan      html  css  js  c++  java
  • 获取页面url信息

    方法:
    window.location.href = prefixURL+'webstatic/messageAnalysis/datadetail.html?id=' + num + "&time=" + time+"&authKey="+this.authKey
    getUrlArgs: function () {
    const query = location.search.substring(1);
    const pairs = query.split('&');
    let args = {};
    let pos;
    let idx;
    let argname;
    let val;
    for (var i = 0; i < pairs.length; i++) {
    pos = pairs[i];
    idx = pos.indexOf('=');
    if (idx == -1) continue;
    argname = pos.substring(0, idx);
    val = decodeURIComponent(pos.substring(idx + 1));
    args[argname] = val;
    }
    return args;
    },
     
    方法调用:
    获取url后面对应的参数名称
     
    let urlArgs = globalFunc.getUrlArgs();
    this.authKey = urlArgs.authKey;
     
  • 相关阅读:
    20200816
    20200815
    20200813
    20200811
    20200810
    20200806
    20200804
    20200803
    20200802
    20200801
  • 原文地址:https://www.cnblogs.com/suixinYB/p/10112010.html
Copyright © 2011-2022 走看看