/** * 获取url参数 * * ```ts * import { URLParams } from 'sunny' * // 假设当前url参数为 ?param1=value1 * console.log(URLParams().get('param1')) * // => 'value1' * // 等同于 * console.log(URLParams('param1=value1').get('param1')) * ``` * * @see 更多api使用方法见{@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} * @param search 例如`?param1=value1`或者`param1=value1`。如果不传默认使用location.search * @category URL */ export declare function URLParams(search?: string): URLSearchParams; /** * 尝试加载scheme URI。通常用在触发app下载场景 * @param URI native app包路径 * @category URL */ export declare function URILoad(URI: string): void; /** * 在当前url path下生成时间戳尾缀。 * 例如:会在/path/to风格url path后追加时间戳尾巴,变为类似/path/to/1596542480766~。 * 适用于单页应用路由场景。 * @category URL */ export declare function URLWithNaughtyTail(): void; /** * 默认基于当前url,跳转到其他path * @see 会调用{@link resolve}解析出绝对url,然后使用`location.assign`执行跳转 * @category URL */ export declare function redirectTo(path: string, base?: string): void; /** * 相对当前文档的url进行路径解析 * * ```ts * import { resolve } from 'sunny-js' * // 假设当前文档url为 https://a.com/path/to/where * console.log(resolve('test.html')) * // => 'https://a.com/path/to/test.html' * // 等同于 * console.log(resolve('test.html', 'https://a.com/path/to/where')) * // => 'https://a.com/path/to/test.html' * ``` * * @param path 路径 * @param base 默认为location.toString() * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/URL * @category URL */ export declare function resolve(path: string, base?: string): string;