Function: getLocationSearchParam
getLocationSearchParam(name
): string
| null
从URL查询字符串中获取指定参数的值
Parameters
Name |
Type |
Description |
name |
string |
要获取的参数名称 |
Returns
string
| null
Description
专门处理location.search部分的参数,格式为?key=value&key2=value2
Throws
Example
// 假设当前URL为: http://www.example.com/?id=123&name=test
getLocationSearchParam('id'); // => "123"
getLocationSearchParam('name'); // => "test"
getLocationSearchParam('none'); // => null