utils.js 619 Bytes
export function getUrlParams(hashString) {
  // #/jplayer-extension?channelId=20000000001310000008&address=52.130.155.147
  const hashParams = hashString.split('?');

  // 去掉 "?" 符号
  const queryString = hashParams[1];

  // 将查询参数字符串解析为键值对对象
  const params = {};
  if (queryString) {
    const paramPairs = queryString.split('&');
    for (let i = 0; i < paramPairs.length; i++) {
      const pair = paramPairs[i].split('=');
      const key = decodeURIComponent(pair[0]);
      const value = decodeURIComponent(pair[1]);
      params[key] = value;
    }
  }

  return params;
}