url参数处理

获取url参数

/**
 * @desc 获取url参数
 */
function getUrlParam(_type, _url) {
  var url = _url || window.location.href;
  if (new RegExp(".*\\b" + _type + "\\b(\\s*=([^&]+)).*", "gi").test(url)) {
    return RegExp.$2;
  } else {
    return null;
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_42979149/article/details/88403135