@hubxu/utils / Exports / url
▸ parseUrl(url): { hash: any ; host: any ; path: any ; protocol: any ; query: any } & Recordable
| Name | Type |
|---|---|
url |
string |
{ hash: any ; host: any ; path: any ; protocol: any ; query: any } & Recordable
▸ redirectToHttps(): void
http跳转到https
void
▸ setObjToUrlParams(baseUrl, obj): string
Add the object as a parameter to the URL
| Name | Type | Description |
|---|---|---|
baseUrl |
string |
url |
obj |
any |
string
eg: let obj = {a: '3', b: '4'} setObjToUrlParams('www.baidu.com', obj) ==>www.baidu.com?a=3&b=4
如果正在编码的字符串只是 URL 的一部分,则应该使用此函数:encodeURIComponent 如果字符串是作为整个 URL 的一部分(例如作为参数传递给 window.open),则应该使用此函数:encodeURI