Function: getUrlNames

getUrlNames(name): Record<string, string>

根据参数获取对应的值

Parameters

Name Type Description
name string 要获取的参数名

Returns

Record<string, string>

返回解析后的参数对象

Throws

当name参数不是字符串时抛出

Example

// window.location.href: 'http://www.baidu.com/?a=1&b=2&state=broker:aaaa1111ccc;tenant:asdfasdf;view_tag:2;
getUrlNames('state');
// => {broker: "aaaa1111ccc", tenant: "asdfasdf", view_tag: "2"}

getUrlNames('view_tag');
// => {view_tag: "2"}
ON THIS PAGE