根据名称获取查询字段值

export function searchParamName(attr: string, search?: string) {
  const match = new RegExp(`[?&]${attr}=([^&]*)`).exec(search || window.location.href);
  return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
最近修改时间:2024-08-14 06:54:07